diff options
Diffstat (limited to 'src')
100 files changed, 3973 insertions, 3227 deletions
diff --git a/src/apprentice.c b/src/apprentice.c index 5d1c4287b..032b76715 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -632,7 +632,7 @@ static void CreateApprenticeMenu(u8 menu) pixelWidth = 0; for (i = 0; i < count; i++) { - s32 width = GetStringWidth(1, strings[i], 0); + s32 width = GetStringWidth(FONT_NORMAL, strings[i], 0); if (width > pixelWidth) pixelWidth = width; } @@ -643,7 +643,7 @@ static void CreateApprenticeMenu(u8 menu) SetStandardWindowBorderStyle(windowId, 0); for (i = 0; i < count; i++) - AddTextPrinterParameterized(windowId, 1, strings[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, strings[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, 0); CreateChooseAnswerTask(TRUE, count, windowId); diff --git a/src/battle_dome.c b/src/battle_dome.c index 84bc774df..1ff89420e 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -4312,7 +4312,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) } // Initialize the text printer - textPrinter.fontId = 2; + textPrinter.fontId = FONT_SHORT; textPrinter.x = 0; textPrinter.y = 0; textPrinter.currentX = textPrinter.x; @@ -4393,7 +4393,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) else textPrinter.currentChar = sBattleDomePotentialTexts[trainerTourneyId]; - textPrinter.fontId = 1; + textPrinter.fontId = FONT_NORMAL; textPrinter.windowId = windowId + 4; textPrinter.currentX = 0; textPrinter.y = 4; @@ -4859,7 +4859,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) StringExpandPlaceholders(gStringVar4, sBattleDomeWinTexts[winStringId]); textPrinter.currentChar = gStringVar4; textPrinter.windowId = windowId + 8; - textPrinter.fontId = 1; + textPrinter.fontId = FONT_NORMAL; PutWindowTilemap(windowId + 8); CopyWindowToVram(windowId + 8, 3); textPrinter.currentX = 0; @@ -4874,7 +4874,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) else CopyDomeTrainerName(gStringVar1, trainerIds[0]); - textPrinter.fontId = 2; + textPrinter.fontId = FONT_SHORT; textPrinter.letterSpacing = 2; textPrinter.currentChar = gStringVar1; textPrinter.windowId = windowId + 6; @@ -5339,7 +5339,7 @@ static void Task_ShowTourneyTree(u8 taskId) gTasks[taskId].tState++; break; case 4: - textPrinter.fontId = 2; + textPrinter.fontId = FONT_SHORT; textPrinter.currentChar = gText_BattleTourney; textPrinter.windowId = 2; textPrinter.x = 0; @@ -5524,7 +5524,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId) { gTasks[taskId].tState = STATE_DELAY; gTasks[taskId].data[3] = 64; - textPrinter.fontId = 2; + textPrinter.fontId = FONT_SHORT; textPrinter.x = 0; textPrinter.y = 0; textPrinter.letterSpacing = 2; diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 64d564062..cd0a44e38 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -1861,7 +1861,7 @@ static void Select_ErasePopupMenu(u8 windowId) static void Select_PrintRentalPkmnString(void) { FillWindowPixelBuffer(SELECT_WIN_TITLE, PIXEL_FILL(0)); - AddTextPrinterParameterized(SELECT_WIN_TITLE, 1, gText_RentalPkmn2, 2, 1, 0, NULL); + AddTextPrinterParameterized(SELECT_WIN_TITLE, FONT_NORMAL, gText_RentalPkmn2, 2, 1, 0, NULL); CopyWindowToVram(SELECT_WIN_TITLE, 3); } @@ -1874,8 +1874,8 @@ static void Select_PrintMonSpecies(void) FillWindowPixelBuffer(SELECT_WIN_SPECIES, PIXEL_FILL(0)); species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL); StringCopy(gStringVar4, gSpeciesNames[species]); - x = GetStringRightAlignXOffset(1, gStringVar4, 86); - AddTextPrinterParameterized3(SELECT_WIN_SPECIES, 1, x, 1, sSpeciesNameTextColors, 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); + AddTextPrinterParameterized3(SELECT_WIN_SPECIES, FONT_NORMAL, x, 1, sSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SELECT_WIN_SPECIES, 2); } @@ -1893,14 +1893,14 @@ static void Select_PrintSelectMonString(void) else str = gText_TheseThreePkmnOkay; - AddTextPrinterParameterized(SELECT_WIN_INFO, 1, str, 2, 5, 0, NULL); + AddTextPrinterParameterized(SELECT_WIN_INFO, FONT_NORMAL, str, 2, 5, 0, NULL); CopyWindowToVram(SELECT_WIN_INFO, 2); } static void Select_PrintCantSelectSameMon(void) { FillWindowPixelBuffer(SELECT_WIN_INFO, PIXEL_FILL(0)); - AddTextPrinterParameterized(SELECT_WIN_INFO, 1, gText_CantSelectSamePkmn, 2, 5, 0, NULL); + AddTextPrinterParameterized(SELECT_WIN_INFO, FONT_NORMAL, gText_CantSelectSamePkmn, 2, 5, 0, NULL); CopyWindowToVram(SELECT_WIN_INFO, 2); } @@ -1910,13 +1910,13 @@ static void Select_PrintMenuOptions(void) PutWindowTilemap(SELECT_WIN_OPTIONS); FillWindowPixelBuffer(SELECT_WIN_OPTIONS, PIXEL_FILL(0)); - AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, 1, 7, 1, sMenuOptionTextColors, 0, gText_Summary); + AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, FONT_NORMAL, 7, 1, sMenuOptionTextColors, 0, gText_Summary); if (selectedId != 0) - AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, 1, 7, 17, sMenuOptionTextColors, 0, gText_Deselect); + AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, FONT_NORMAL, 7, 17, sMenuOptionTextColors, 0, gText_Deselect); else - AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, 1, 7, 17, sMenuOptionTextColors, 0, gText_Rent); + AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, FONT_NORMAL, 7, 17, sMenuOptionTextColors, 0, gText_Rent); - AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, 1, 7, 33, sMenuOptionTextColors, 0, gText_Others2); + AddTextPrinterParameterized3(SELECT_WIN_OPTIONS, FONT_NORMAL, 7, 33, sMenuOptionTextColors, 0, gText_Others2); CopyWindowToVram(SELECT_WIN_OPTIONS, 3); } @@ -1924,8 +1924,8 @@ static void Select_PrintYesNoOptions(void) { PutWindowTilemap(SELECT_WIN_YES_NO); FillWindowPixelBuffer(SELECT_WIN_YES_NO, PIXEL_FILL(0)); - AddTextPrinterParameterized3(SELECT_WIN_YES_NO, 1, 7, 1, sMenuOptionTextColors, 0, gText_Yes2); - AddTextPrinterParameterized3(SELECT_WIN_YES_NO, 1, 7, 17, sMenuOptionTextColors, 0, gText_No2); + AddTextPrinterParameterized3(SELECT_WIN_YES_NO, FONT_NORMAL, 7, 1, sMenuOptionTextColors, 0, gText_Yes2); + AddTextPrinterParameterized3(SELECT_WIN_YES_NO, FONT_NORMAL, 7, 17, sMenuOptionTextColors, 0, gText_No2); CopyWindowToVram(SELECT_WIN_YES_NO, 3); } @@ -1994,8 +1994,8 @@ static void Select_PrintMonCategory(void) FillWindowPixelBuffer(SELECT_WIN_MON_CATEGORY, PIXEL_FILL(0)); species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL); CopyMonCategoryText(SpeciesToNationalPokedexNum(species), text); - x = GetStringRightAlignXOffset(1, text, 0x76); - AddTextPrinterParameterized(SELECT_WIN_MON_CATEGORY, 1, text, x, 1, 0, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x76); + AddTextPrinterParameterized(SELECT_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL); CopyWindowToVram(SELECT_WIN_MON_CATEGORY, 2); } } @@ -3753,7 +3753,7 @@ static void Swap_EraseActionFadeWindow(void) static void Swap_PrintPkmnSwap(void) { FillWindowPixelBuffer(SWAP_WIN_TITLE, PIXEL_FILL(1)); - AddTextPrinterParameterized(SWAP_WIN_TITLE, 1, gText_PkmnSwap, 2, 1, 0, NULL); + AddTextPrinterParameterized(SWAP_WIN_TITLE, FONT_NORMAL, gText_PkmnSwap, 2, 1, 0, NULL); CopyWindowToVram(SWAP_WIN_TITLE, 3); } @@ -3775,8 +3775,8 @@ static void Swap_PrintMonSpecies(void) else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); StringCopy(gStringVar4, gSpeciesNames[species]); - x = GetStringRightAlignXOffset(1, gStringVar4, 86); - AddTextPrinterParameterized3(SWAP_WIN_SPECIES, 1, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); + AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES, 3); } } @@ -3784,7 +3784,7 @@ static void Swap_PrintMonSpecies(void) static void Swap_PrintOnInfoWindow(const u8 *str) { FillWindowPixelBuffer(SWAP_WIN_INFO, PIXEL_FILL(0)); - AddTextPrinterParameterized(SWAP_WIN_INFO, 1, str, 2, 5, 0, NULL); + AddTextPrinterParameterized(SWAP_WIN_INFO, FONT_NORMAL, str, 2, 5, 0, NULL); CopyWindowToVram(SWAP_WIN_INFO, 2); } @@ -3792,9 +3792,9 @@ static void Swap_PrintMenuOptions(void) { PutWindowTilemap(SWAP_WIN_OPTIONS); FillWindowPixelBuffer(SWAP_WIN_OPTIONS, PIXEL_FILL(0)); - AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, 1, 15, 1, sSwapMenuOptionsTextColors, 0, gText_Summary2); - AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, 1, 15, 17, sSwapMenuOptionsTextColors, 0, gText_Swap); - AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, 1, 15, 33, sSwapMenuOptionsTextColors, 0, gText_Rechoose); + AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, FONT_NORMAL, 15, 1, sSwapMenuOptionsTextColors, 0, gText_Summary2); + AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, FONT_NORMAL, 15, 17, sSwapMenuOptionsTextColors, 0, gText_Swap); + AddTextPrinterParameterized3(SWAP_WIN_OPTIONS, FONT_NORMAL, 15, 33, sSwapMenuOptionsTextColors, 0, gText_Rechoose); CopyWindowToVram(SWAP_WIN_OPTIONS, 3); } @@ -3802,15 +3802,15 @@ static void Swap_PrintYesNoOptions(void) { PutWindowTilemap(SWAP_WIN_YES_NO); FillWindowPixelBuffer(SWAP_WIN_YES_NO, PIXEL_FILL(0)); - AddTextPrinterParameterized3(SWAP_WIN_YES_NO, 1, 7, 1, sSwapMenuOptionsTextColors, 0, gText_Yes3); - AddTextPrinterParameterized3(SWAP_WIN_YES_NO, 1, 7, 17, sSwapMenuOptionsTextColors, 0, gText_No3); + AddTextPrinterParameterized3(SWAP_WIN_YES_NO, FONT_NORMAL, 7, 1, sSwapMenuOptionsTextColors, 0, gText_Yes3); + AddTextPrinterParameterized3(SWAP_WIN_YES_NO, FONT_NORMAL, 7, 17, sSwapMenuOptionsTextColors, 0, gText_No3); CopyWindowToVram(SWAP_WIN_YES_NO, 3); } static void Swap_PrintActionString(const u8 *str, u32 y, u32 windowId) { - s32 x = GetStringRightAlignXOffset(0, str, 0x46); - AddTextPrinterParameterized3(windowId, 0, x, y, sSwapMenuOptionsTextColors, 0, str); + s32 x = GetStringRightAlignXOffset(FONT_SMALL, str, 0x46); + AddTextPrinterParameterized3(windowId, FONT_SMALL, x, y, sSwapMenuOptionsTextColors, 0, str); } static void Swap_PrintActionStrings(void) @@ -3884,8 +3884,8 @@ static void Swap_PrintMonSpeciesAtFade(void) else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); StringCopy(gStringVar4, gSpeciesNames[species]); - x = GetStringRightAlignXOffset(1, gStringVar4, 86); - AddTextPrinterParameterized3(SWAP_WIN_SPECIES_AT_FADE, 1, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); + AddTextPrinterParameterized3(SWAP_WIN_SPECIES_AT_FADE, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES_AT_FADE, 3); } } @@ -3911,8 +3911,8 @@ static void Swap_PrintMonSpeciesForTransition(void) else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); StringCopy(gStringVar4, gSpeciesNames[species]); - x = GetStringRightAlignXOffset(1, gStringVar4, 86); - AddTextPrinterParameterized3(SWAP_WIN_SPECIES, 1, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); + AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES, 3); } } @@ -3937,8 +3937,8 @@ static void Swap_PrintMonCategory(void) else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); CopyMonCategoryText(SpeciesToNationalPokedexNum(species), text); - x = GetStringRightAlignXOffset(1, text, 0x76); - AddTextPrinterParameterized(SWAP_WIN_MON_CATEGORY, 1, text, x, 1, 0, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x76); + AddTextPrinterParameterized(SWAP_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL); CopyWindowToVram(SWAP_WIN_MON_CATEGORY, 2); } } diff --git a/src/battle_interface.c b/src/battle_interface.c index 08da2da5f..17497cb2f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -718,21 +718,8 @@ static const struct SpriteTemplate sStatusSummaryBallsSpriteTemplates[2] = } }; -// possibly text -static const u8 sUnknown_0832C3C4[] = -{ - 0xfc, 0x01, 0x01, 0xfc, 0x02, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; - -// possibly text -static const u8 sUnknown_0832C3D8[] = -{ - 0xfc, 0x01, 0x01, 0xfc, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, -}; +static const u8 sEmptyWhiteText_GrayHighlight[] = __("{COLOR WHITE}{HIGHLIGHT DARK_GRAY} "); +static const u8 sEmptyWhiteText_TransparentHighlight[] = __("{COLOR WHITE}{HIGHLIGHT TRANSPARENT} "); enum { @@ -1166,7 +1153,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) { u8 battler; - memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4)); + memcpy(text, sEmptyWhiteText_GrayHighlight, sizeof(sEmptyWhiteText_GrayHighlight)); battler = gSprites[healthboxSpriteId].hMain_Battler; if (IsDoubleBattle() == TRUE || GetBattlerSide(battler) == B_SIDE_OPPONENT) { @@ -1193,7 +1180,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent) } ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3); - RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); + RenderTextHandleBold(gMonSpritesGfxPtr->barFontGfx, FONT_BOLD, text); for (i = 0; i < 3; i++) { @@ -1245,7 +1232,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 { u8 battlerId; - memcpy(text, sUnknown_0832C3D8, sizeof(sUnknown_0832C3D8)); + memcpy(text, sEmptyWhiteText_TransparentHighlight, sizeof(sEmptyWhiteText_TransparentHighlight)); battlerId = gSprites[healthboxSpriteId].hMain_Battler; if (gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) // don't print text if only bars are visible @@ -1262,7 +1249,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 txtPtr = ConvertIntToDecimalStringN(text + 6, value, STR_CONV_MODE_RIGHT_ALIGN, 3); if (!maxOrCurrent) StringCopy(txtPtr, gText_Slash); - RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); + RenderTextHandleBold(gMonSpritesGfxPtr->barFontGfx, FONT_BOLD, text); for (i = var; i < var + 3; i++) { @@ -1308,12 +1295,12 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon) u8 *barFontGfx; u8 i, var, nature, healthBarSpriteId; - memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4)); + memcpy(text, sEmptyWhiteText_GrayHighlight, sizeof(sEmptyWhiteText_GrayHighlight)); barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBattlerPosition(gSprites[healthboxSpriteId].hMain_Battler) * 384)]; var = 5; nature = GetNature(mon); StringCopy(text + 6, gNatureNamePointers[nature]); - RenderTextFont9(barFontGfx, 9, text); + RenderTextHandleBold(barFontGfx, FONT_BOLD, text); for (j = 6, i = 0; i < var; i++, j++) { @@ -1345,7 +1332,7 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon) ConvertIntToDecimalStringN(text + 9, gBattleStruct->safariEscapeFactor, STR_CONV_MODE_RIGHT_ALIGN, 2); text[5] = CHAR_SPACE; text[8] = CHAR_SLASH; - RenderTextFont9(gMonSpritesGfxPtr->barFontGfx, 9, text); + RenderTextHandleBold(gMonSpritesGfxPtr->barFontGfx, FONT_BOLD, text); j = healthBarSpriteId; // Needed to match for some reason. for (j = 0; j < 5; j++) @@ -2130,7 +2117,7 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId) txtPtr = StringCopy(text, gText_SafariBallLeft); ConvertIntToDecimalStringN(txtPtr, gNumSafariBalls, STR_CONV_MODE_LEFT_ALIGN, 2); - windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, GetStringRightAlignXOffset(0, text, 0x2F), 3, 2, &windowId); + windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, GetStringRightAlignXOffset(FONT_SMALL, text, 0x2F), 3, 2, &windowId); spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP; SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x2C0) + spriteTileNum, windowTileData, 2); SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0xA00) + spriteTileNum, windowTileData + 0x40, 4); @@ -2538,7 +2525,7 @@ static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, color[1] = 1; color[2] = 3; - AddTextPrinterParameterized4(winId, 0, x, y, 0, 0, color, -1, str); + AddTextPrinterParameterized4(winId, FONT_SMALL, x, y, 0, 0, color, -1, str); *windowId = winId; return (u8*)(GetWindowAttribute(winId, WINDOW_TILE_DATA)); diff --git a/src/battle_message.c b/src/battle_message.c index 91142dd55..31f256e3c 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1478,7 +1478,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = { [B_WIN_MSG] = { .fillValue = PIXEL_FILL(0xF), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1490,7 +1490,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_ACTION_PROMPT] = { .fillValue = PIXEL_FILL(0xF), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 1, .y = 1, .letterSpacing = 0, @@ -1502,7 +1502,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_ACTION_MENU] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1514,7 +1514,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_MOVE_NAME_1] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1526,7 +1526,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_MOVE_NAME_2] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1538,7 +1538,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_MOVE_NAME_3] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1550,7 +1550,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_MOVE_NAME_4] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1562,7 +1562,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_PP] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1574,7 +1574,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_DUMMY] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1586,7 +1586,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_PP_REMAINING] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 2, .y = 1, .letterSpacing = 0, @@ -1598,7 +1598,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_MOVE_TYPE] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1610,7 +1610,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_SWITCH_PROMPT] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1622,7 +1622,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_YESNO] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1634,7 +1634,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_LEVEL_UP_BOX] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1646,7 +1646,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_LEVEL_UP_BANNER] = { .fillValue = PIXEL_FILL(0), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 32, .y = 1, .letterSpacing = 0, @@ -1658,7 +1658,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_PLAYER] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1670,7 +1670,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_OPPONENT] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1682,7 +1682,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_MULTI_PLAYER_1] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1694,7 +1694,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_MULTI_PLAYER_2] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1706,7 +1706,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_MULTI_PLAYER_3] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1718,7 +1718,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_MULTI_PLAYER_4] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1730,7 +1730,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_OUTCOME_DRAW] = { .fillValue = PIXEL_FILL(0), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1742,7 +1742,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_OUTCOME_LEFT] = { .fillValue = PIXEL_FILL(0), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1754,7 +1754,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = }, [B_WIN_VS_OUTCOME_RIGHT] = { .fillValue = PIXEL_FILL(0x0), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1770,7 +1770,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = { [B_WIN_MSG] = { .fillValue = PIXEL_FILL(0xF), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1782,7 +1782,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_ACTION_PROMPT] = { .fillValue = PIXEL_FILL(0xF), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 1, .y = 1, .letterSpacing = 0, @@ -1794,7 +1794,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_ACTION_MENU] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1806,7 +1806,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_MOVE_NAME_1] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1818,7 +1818,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_MOVE_NAME_2] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1830,7 +1830,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_MOVE_NAME_3] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1842,7 +1842,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_MOVE_NAME_4] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1854,7 +1854,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_PP] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1866,7 +1866,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_DUMMY] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1878,7 +1878,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_PP_REMAINING] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 2, .y = 1, .letterSpacing = 0, @@ -1890,7 +1890,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_MOVE_TYPE] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1902,7 +1902,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_SWITCH_PROMPT] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 7, + .fontId = FONT_NARROW, .x = 0, .y = 1, .letterSpacing = 0, @@ -1914,7 +1914,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_YESNO] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1926,7 +1926,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_LEVEL_UP_BOX] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, @@ -1938,7 +1938,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [B_WIN_LEVEL_UP_BANNER] = { .fillValue = PIXEL_FILL(0), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 32, .y = 1, .letterSpacing = 0, @@ -1950,7 +1950,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_PLAYER_NAME] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1962,7 +1962,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_VS] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1974,7 +1974,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_OPPONENT_NAME] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1986,7 +1986,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_MIND] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -1998,7 +1998,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_SKILL] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -2010,7 +2010,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_BODY] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -2022,7 +2022,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_JUDGEMENT_TITLE] = { .fillValue = PIXEL_FILL(0xE), - .fontId = 1, + .fontId = FONT_NORMAL, .x = -1, .y = 1, .letterSpacing = 0, @@ -2034,7 +2034,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] = }, [ARENA_WIN_JUDGEMENT_TEXT] = { .fillValue = PIXEL_FILL(0x1), - .fontId = 1, + .fontId = FONT_NORMAL, .x = 0, .y = 1, .letterSpacing = 0, diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 286049e8b..ea6e79f86 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -88,8 +88,8 @@ static void CopyBagItemName(u8 *, u16); static void FreeItemIconSpriteByAltId(u8); static void PrintItemDescription(s32); static void PrintSelectorArrowAtPos(u8, u8); -static void PrintOnWindow_Font1(u8, const u8 *, u8, u8, u8, u8, u8, u8); -static void PrintOnWindow_Font7(u8, const u8 *, u8, u8, u8, u8, u8, u8); +static void PyramidBagPrint(u8, const u8 *, u8, u8, u8, u8, u8, u8); +static void PyramidBagPrint_Quantity(u8, const u8 *, u8, u8, u8, u8, u8, u8); static u8 OpenMenuActionWindowById(u8); static void CloseMenuActionWindowById(u8); static void PrintMenuActionText_SingleRow(u8); @@ -159,7 +159,7 @@ static const struct ListMenuTemplate sListMenuTemplate = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, - .fontId = 7, + .fontId = FONT_NARROW, .cursorKind = 0 }; @@ -672,8 +672,8 @@ static void PrintItemQuantity(u8 windowId, u32 itemIndex, u8 y) STR_CONV_MODE_RIGHT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_xVar1); - xAlign = GetStringRightAlignXOffset(7, gStringVar4, 119); - PrintOnWindow_Font7(windowId, gStringVar4, xAlign, y, 0, 0, TEXT_SPEED_FF, COLORID_DARK_GRAY); + xAlign = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 119); + PyramidBagPrint_Quantity(windowId, gStringVar4, xAlign, y, 0, 0, TEXT_SPEED_FF, COLORID_DARK_GRAY); } static void PrintItemDescription(s32 listMenuId) @@ -690,7 +690,7 @@ static void PrintItemDescription(s32 listMenuId) desc = gStringVar4; } FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, desc, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, desc, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); } static void AddScrollArrows(void) @@ -849,9 +849,9 @@ static void PrintSelectorArrow(u8 listMenuTaskId, u8 colorId) static void PrintSelectorArrowAtPos(u8 y, u8 colorId) { if (colorId == COLORID_NONE) // If 'no color', erase arrow - FillWindowPixelRect(WIN_LIST, PIXEL_FILL(0), 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1)); + FillWindowPixelRect(WIN_LIST, PIXEL_FILL(0), 0, y, GetMenuCursorDimensionByFont(FONT_NORMAL, 0), GetMenuCursorDimensionByFont(FONT_NORMAL, 1)); else - PrintOnWindow_Font1(WIN_LIST, gText_SelectorArrow2, 0, y, 0, 0, 0, colorId); + PyramidBagPrint(WIN_LIST, gText_SelectorArrow2, 0, y, 0, 0, 0, colorId); } void CloseBattlePyramidBag(u8 taskId) @@ -962,7 +962,7 @@ static void OpenContextMenu(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); if (gPyramidBagMenu->menuActionsCount == 1) PrintMenuActionText_SingleRow(OpenMenuActionWindowById(MENU_WIN_1x1)); else if (gPyramidBagMenu->menuActionsCount == 2) @@ -978,13 +978,13 @@ static void OpenContextMenu(u8 taskId) static void PrintMenuActionText_SingleRow(u8 windowId) { - AddItemMenuActionTextPrinters(windowId, 7, 8, 1, 0, 0x10, gPyramidBagMenu->menuActionsCount, sMenuActions, gPyramidBagMenu->menuActionIds); + AddItemMenuActionTextPrinters(windowId, FONT_NARROW, 8, 1, 0, 0x10, gPyramidBagMenu->menuActionsCount, sMenuActions, gPyramidBagMenu->menuActionIds); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, gPyramidBagMenu->menuActionsCount, 0); } static void PrintMenuActionText_MultiRow(u8 windowId, u8 horizontalCount, u8 verticalCount) { - PrintMenuActionGrid(windowId, 7, 8, 1, 56, horizontalCount, verticalCount, sMenuActions, gPyramidBagMenu->menuActionIds); + PrintMenuActionGrid(windowId, FONT_NARROW, 8, 1, 56, horizontalCount, verticalCount, sMenuActions, gPyramidBagMenu->menuActionIds); InitMenuActionGrid(windowId, 56, horizontalCount, verticalCount, 0); } @@ -1137,7 +1137,7 @@ static void BagAction_Toss(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); ShowNumToToss(); gTasks[taskId].func = Task_ChooseHowManyToToss; } @@ -1151,7 +1151,7 @@ static void AskConfirmToss(u8 taskId) ConvertIntToDecimalStringN(gStringVar2, tNumToToss, STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); CreatePyramidBagYesNo(taskId, &sYesNoTossFuncions); } @@ -1170,8 +1170,8 @@ static void ShowNumToToss(void) ConvertIntToDecimalStringN(gStringVar1, 1, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_xVar1); DrawTossNumberWindow(WIN_TOSS_NUM); - x = GetStringCenterAlignXOffset(1, gStringVar4, 0x28); - AddTextPrinterParameterized(WIN_TOSS_NUM, 1, gStringVar4, x, 2, 0, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 0x28); + AddTextPrinterParameterized(WIN_TOSS_NUM, FONT_NORMAL, gStringVar4, x, 2, 0, NULL); } static void UpdateNumToToss(s16 num) @@ -1179,8 +1179,8 @@ static void UpdateNumToToss(s16 num) s32 x; ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_xVar1); - x = GetStringCenterAlignXOffset(1, gStringVar4, 0x28); - AddTextPrinterParameterized(WIN_TOSS_NUM, 1, gStringVar4, x, 2, 0, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 0x28); + AddTextPrinterParameterized(WIN_TOSS_NUM, FONT_NORMAL, gStringVar4, x, 2, 0, NULL); } static void Task_ChooseHowManyToToss(u8 taskId) @@ -1219,7 +1219,7 @@ static void TossItem(u8 taskId) ConvertIntToDecimalStringN(gStringVar2, tNumToToss, STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); gTasks[taskId].func = Task_TossItem; } @@ -1316,7 +1316,7 @@ static void Task_BeginItemSwap(u8 taskId) CopyItemName(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][tListPos], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where); FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0)); - PrintOnWindow_Font1(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); + PyramidBagPrint(WIN_INFO, gStringVar4, 3, 0, 0, 1, 0, COLORID_DARK_GRAY); PrintSelectorArrow(tListTaskId, COLORID_LIGHT_GRAY); UpdateSwapLinePos(tListPos); gTasks[taskId].func = Task_ItemSwapHandleInput; @@ -1454,14 +1454,14 @@ static void InitPyramidBagWindows(void) ScheduleBgCopyTilemapToVram(1); } -static void PrintOnWindow_Font1(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId) +static void PyramidBagPrint(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId) { - AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, sTextColors[colorTableId], speed, src); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, lineSpacing, sTextColors[colorTableId], speed, src); } -static void PrintOnWindow_Font7(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId) +static void PyramidBagPrint_Quantity(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId) { - AddTextPrinterParameterized4(windowId, 7, x, y, letterSpacing, lineSpacing, sTextColors[colorTableId], speed, src); + AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, letterSpacing, lineSpacing, sTextColors[colorTableId], speed, src); } static void DrawTossNumberWindow(u8 windowId) @@ -1509,7 +1509,7 @@ static void CreatePyramidBagYesNo(u8 taskId, const struct YesNoFuncTable *yesNoT void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId)) { FillWindowPixelBuffer(WIN_MSG, PIXEL_FILL(1)); - DisplayMessageAndContinueTask(taskId, WIN_MSG, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback); + DisplayMessageAndContinueTask(taskId, WIN_MSG, 0xA, 0xD, FONT_NORMAL, GetPlayerTextSpeedDelay(), str, callback); ScheduleBgCopyTilemapToVram(1); } diff --git a/src/battle_records.c b/src/battle_records.c index b2e379093..5c8c92d84 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -279,8 +279,8 @@ static void PrintLinkBattleWinsLossesDraws(struct LinkBattleRecord *records) ConvertIntToDecimalStringN(gStringVar3, GetGameStat(GAME_STAT_LINK_BATTLE_DRAWS), STR_CONV_MODE_LEFT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_TotalRecordWLD); - x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 0x11, 0, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 0xD0); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x, 0x11, 0, NULL); } static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 language) @@ -288,10 +288,10 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan if (record->wins == 0 && record->losses == 0 && record->draws == 0) { // empty slot - AddTextPrinterParameterized(gRecordsWindowId, 1, sText_DashesNoPlayer, 8, (y * 8) + 1, 0, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, sText_DashesNoScore, 80, (y * 8) + 1, 0, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, sText_DashesNoScore, 128, (y * 8) + 1, 0, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, sText_DashesNoScore, 176, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sText_DashesNoPlayer, 8, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sText_DashesNoScore, 80, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sText_DashesNoScore, 128, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sText_DashesNoScore, 176, (y * 8) + 1, 0, NULL); } else { @@ -299,16 +299,16 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan StringCopyN(gStringVar1, record->name, 7); ConvertInternationalString(gStringVar1, language); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar1, 8, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar1, 8, (y * 8) + 1, 0, NULL); ConvertIntToDecimalStringN(gStringVar1, record->wins, STR_CONV_MODE_RIGHT_ALIGN, 4); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar1, 80, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar1, 80, (y * 8) + 1, 0, NULL); ConvertIntToDecimalStringN(gStringVar1, record->losses, STR_CONV_MODE_RIGHT_ALIGN, 4); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar1, 128, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar1, 128, (y * 8) + 1, 0, NULL); ConvertIntToDecimalStringN(gStringVar1, record->draws, STR_CONV_MODE_RIGHT_ALIGN, 4); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar1, 176, (y * 8) + 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar1, 176, (y * 8) + 1, 0, NULL); } } @@ -321,12 +321,12 @@ void ShowLinkBattleRecords(void) FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1)); StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults); - x = GetStringCenterAlignXOffset(1, gStringVar4, 208); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 1, 0, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 208); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x, 1, 0, NULL); PrintLinkBattleWinsLossesDraws(gSaveBlock1Ptr->linkBattleRecords.entries); StringExpandPlaceholders(gStringVar4, gText_WinLoseDraw); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 41, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, 0, 41, 0, NULL); for (i = 0; i < LINK_B_RECORDS_COUNT; i++) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2bc1cfedb..92e5b31e9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6041,7 +6041,7 @@ static void DrawLevelUpBannerText(void) printerTemplate.currentChar = gStringVar4; printerTemplate.windowId = B_WIN_LEVEL_UP_BANNER; - printerTemplate.fontId = 0; + printerTemplate.fontId = FONT_SMALL; printerTemplate.x = 32; printerTemplate.y = 0; printerTemplate.currentX = 32; diff --git a/src/battle_setup.c b/src/battle_setup.c index 90c004b55..a1b01f9c1 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -47,8 +47,14 @@ #include "constants/trainers.h" #include "constants/trainer_hill.h" -enum -{ +enum { + TRANSITION_TYPE_NORMAL, + TRANSITION_TYPE_CAVE, + TRANSITION_TYPE_FLASH, + TRANSITION_TYPE_WATER, +}; + +enum { TRAINER_PARAM_LOAD_VAL_8BIT, TRAINER_PARAM_LOAD_VAL_16BIT, TRAINER_PARAM_LOAD_VAL_32BIT, @@ -85,7 +91,6 @@ static void HandleRematchVarsOnBattleEnd(void); static const u8 *GetIntroSpeechOfApproachingTrainer(void); static const u8 *GetTrainerCantBattleSpeech(void); -// ewram vars EWRAM_DATA static u16 sTrainerBattleMode = 0; EWRAM_DATA u16 gTrainerBattleOpponent_A = 0; EWRAM_DATA u16 gTrainerBattleOpponent_B = 0; @@ -103,24 +108,22 @@ EWRAM_DATA static u8 *sTrainerBBattleScriptRetAddr = NULL; EWRAM_DATA static bool8 sShouldCheckTrainerBScript = FALSE; EWRAM_DATA static u8 sNoOfPossibleTrainerRetScripts = 0; -// const rom data - // The first transition is used if the enemy pokemon are lower level than our pokemon. // Otherwise, the second transition is used. static const u8 sBattleTransitionTable_Wild[][2] = { - {B_TRANSITION_SLICE, B_TRANSITION_WHITEFADE}, // Normal - {B_TRANSITION_CLOCKWISE_BLACKFADE, B_TRANSITION_GRID_SQUARES}, // Cave - {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, // Cave with flash used - {B_TRANSITION_WAVE, B_TRANSITION_RIPPLE}, // Water + [TRANSITION_TYPE_NORMAL] = {B_TRANSITION_SLICE, B_TRANSITION_WHITE_BARS_FADE}, + [TRANSITION_TYPE_CAVE] = {B_TRANSITION_CLOCKWISE_WIPE, B_TRANSITION_GRID_SQUARES}, + [TRANSITION_TYPE_FLASH] = {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, + [TRANSITION_TYPE_WATER] = {B_TRANSITION_WAVE, B_TRANSITION_RIPPLE}, }; static const u8 sBattleTransitionTable_Trainer[][2] = { - {B_TRANSITION_POKEBALLS_TRAIL, B_TRANSITION_SHARDS}, // Normal - {B_TRANSITION_SHUFFLE, B_TRANSITION_BIG_POKEBALL}, // Cave - {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, // Cave with flash used - {B_TRANSITION_SWIRL, B_TRANSITION_RIPPLE}, // Water + [TRANSITION_TYPE_NORMAL] = {B_TRANSITION_POKEBALLS_TRAIL, B_TRANSITION_ANGLED_WIPES}, + [TRANSITION_TYPE_CAVE] = {B_TRANSITION_SHUFFLE, B_TRANSITION_BIG_POKEBALL}, + [TRANSITION_TYPE_FLASH] = {B_TRANSITION_BLUR, B_TRANSITION_GRID_SQUARES}, + [TRANSITION_TYPE_WATER] = {B_TRANSITION_SWIRL, B_TRANSITION_RIPPLE}, }; // Battle Frontier (excluding Pyramid and Dome, which have their own tables below) @@ -552,7 +555,7 @@ void StartGroudonKyogreBattle(void) gBattleTypeFlags = BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_KYOGRE_GROUDON; if (gGameVersion == VERSION_RUBY) - CreateBattleStartTask(B_TRANSITION_SHARDS, MUS_VS_KYOGRE_GROUDON); // GROUDON + CreateBattleStartTask(B_TRANSITION_ANGLED_WIPES, MUS_VS_KYOGRE_GROUDON); // GROUDON else CreateBattleStartTask(B_TRANSITION_RIPPLE, MUS_VS_KYOGRE_GROUDON); // KYOGRE @@ -697,20 +700,20 @@ static u8 GetBattleTransitionTypeByMap(void) PlayerGetDestCoords(&x, &y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y); if (Overworld_GetFlashLevel()) - return B_TRANSITION_SHUFFLE; + return TRANSITION_TYPE_FLASH; if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior)) { switch (gMapHeader.mapType) { case MAP_TYPE_UNDERGROUND: - return B_TRANSITION_SWIRL; + return TRANSITION_TYPE_CAVE; case MAP_TYPE_UNDERWATER: - return B_TRANSITION_BIG_POKEBALL; + return TRANSITION_TYPE_WATER; default: - return B_TRANSITION_BLUR; + return TRANSITION_TYPE_NORMAL; } } - return B_TRANSITION_BIG_POKEBALL; + return TRANSITION_TYPE_WATER; } static u16 GetSumOfPlayerPartyLevel(u8 numMons) diff --git a/src/battle_tower.c b/src/battle_tower.c index b2f81cc1a..d9bd18bf7 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1909,7 +1909,7 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId) void FrontierSpeechToString(const u16 *words) { ConvertEasyChatWordsToString(gStringVar4, words, 3, 2); - if (GetStringWidth(1, gStringVar4, -1) > 204u) + if (GetStringWidth(FONT_NORMAL, gStringVar4, -1) > 204u) { s32 i = 0; diff --git a/src/battle_transition.c b/src/battle_transition.c index 2fc4c6854..1e421b5e4 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -25,6 +25,33 @@ #include "constants/trainers.h" #include "constants/rgb.h" +#define PALTAG_UNUSED_MUGSHOT 0x100A + +#define B_TRANS_DMA_FLAGS (1 | ((DMA_SRC_INC | DMA_DEST_FIXED | DMA_REPEAT | DMA_16BIT | DMA_START_HBLANK | DMA_ENABLE) << 16)) + +// Used by each transition task to determine which of its functions to call +#define tState data[0] + +// Below are data defines for InitBlackWipe and UpdateBlackWipe, for the TransitionData data array. +// These will be re-used by any transitions that use these functions. +#define tWipeStartX data[0] +#define tWipeStartY data[1] +#define tWipeCurrX data[2] +#define tWipeCurrY data[3] +#define tWipeEndX data[4] +#define tWipeEndY data[5] +#define tWipeXMove data[6] +#define tWipeYMove data[7] +#define tWipeXDist data[8] +#define tWipeYDist data[9] +#define tWipeTemp data[10] + +#define SET_TILE(ptr, posY, posX, tile) \ +{ \ + u32 index = (posY) * 32 + posX; \ + ptr[index] = tile | (0xF0 << 8); \ +} + struct TransitionData { vu8 VBlank_DMA; @@ -32,245 +59,242 @@ struct TransitionData u16 WINOUT; u16 WIN0H; u16 WIN0V; - u16 field_A; // unused - u16 field_C; // unused + u16 unused1; + u16 unused2; u16 BLDCNT; u16 BLDALPHA; u16 BLDY; - s16 field_14; - s16 field_16; - s16 BG0HOFS_1; - s16 BG0HOFS_2; + s16 cameraX; + s16 cameraY; + s16 BG0HOFS_Lower; + s16 BG0HOFS_Upper; s16 BG0VOFS; // used but not set - s16 field_1E; // unused - s16 field_20; - s16 field_22; // unused + s16 unused3; + s16 counter; + s16 unused4; s16 data[11]; }; -struct StructRectangularSpiral +struct RectangularSpiralLine { - u8 field_0; - s16 field_2; - u8 field_4; - s16 field_6; - u8 field_8; + u8 state; + s16 position; + u8 moveIdx; + s16 reboundPosition; + bool8 outward; }; typedef bool8 (*TransitionStateFunc)(struct Task *task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); -// this file's functions -static void LaunchBattleTransitionTask(u8 transitionId); -static void Task_BattleTransitionMain(u8 taskId); -static void Phase1Task_TransitionAll(u8 taskId); -static void Phase2Task_Blur(u8 taskId); -static void Phase2Task_Swirl(u8 taskId); -static void Phase2Task_Shuffle(u8 taskId); -static void Phase2Task_BigPokeball(u8 taskId); -static void Phase2Task_PokeballsTrail(u8 taskId); -static void Phase2Task_Clockwise_BlackFade(u8 taskId); -static void Phase2Task_Ripple(u8 taskId); -static void Phase2Task_Wave(u8 taskId); -static void Phase2Task_Slice(u8 taskId); -static void Phase2Task_WhiteFade(u8 taskId); -static void Phase2Task_GridSquares(u8 taskId); -static void Phase2Task_Shards(u8 taskId); -static void Phase2Task_Sidney(u8 taskId); -static void Phase2Task_Phoebe(u8 taskId); -static void Phase2Task_Glacia(u8 taskId); -static void Phase2Task_Drake(u8 taskId); -static void Phase2Task_Champion(u8 taskId); -static void Phase2Task_Aqua(u8 taskId); -static void Phase2Task_Magma(u8 taskId); -static void Phase2Task_Regice(u8 taskId); -static void Phase2Task_Registeel(u8 taskId); -static void Phase2Task_Regirock(u8 taskId); -static void Phase2Task_Kyogre(u8 taskId); -static void Phase2Task_Groudon(u8 taskId); -static void Phase2Task_Rayquaza(u8 taskId); -static void Phase2Task_ShredSplit(u8 taskId); -static void Phase2Task_Blackhole1(u8 taskId); -static void Phase2Task_Blackhole2(u8 taskId); -static void Phase2Task_RectangularSpiral(u8 taskId); -static void Phase2Task_FrontierLogoWiggle(u8 taskId); -static void Phase2Task_FrontierLogoWave(u8 taskId); -static void Phase2Task_FrontierSquares(u8 taskId); -static void Phase2Task_FrontierSquaresScroll(u8 taskId); -static void Phase2Task_FrontierSquaresSpiral(u8 taskId); +static bool8 Transition_StartIntro(struct Task *); +static bool8 Transition_WaitForIntro(struct Task *); +static bool8 Transition_StartMain(struct Task *); +static bool8 Transition_WaitForMain(struct Task *); + +static void LaunchBattleTransitionTask(u8); +static void Task_BattleTransition(u8); +static void Task_Intro(u8); +static void Task_Blur(u8); +static void Task_Swirl(u8); +static void Task_Shuffle(u8); +static void Task_BigPokeball(u8); +static void Task_PokeballsTrail(u8); +static void Task_ClockwiseWipe(u8); +static void Task_Ripple(u8); +static void Task_Wave(u8); +static void Task_Slice(u8); +static void Task_WhiteBarsFade(u8); +static void Task_GridSquares(u8); +static void Task_AngledWipes(u8); +static void Task_Sidney(u8); +static void Task_Phoebe(u8); +static void Task_Glacia(u8); +static void Task_Drake(u8); +static void Task_Champion(u8); +static void Task_Aqua(u8); +static void Task_Magma(u8); +static void Task_Regice(u8); +static void Task_Registeel(u8); +static void Task_Regirock(u8); +static void Task_Kyogre(u8); +static void Task_Groudon(u8); +static void Task_Rayquaza(u8); +static void Task_ShredSplit(u8); +static void Task_Blackhole(u8); +static void Task_BlackholePulsate(u8); +static void Task_RectangularSpiral(u8); +static void Task_FrontierLogoWiggle(u8); +static void Task_FrontierLogoWave(u8); +static void Task_FrontierSquares(u8); +static void Task_FrontierSquaresScroll(u8); +static void Task_FrontierSquaresSpiral(u8); static void VBlankCB_BattleTransition(void); -static void VBlankCB_Phase2_Swirl(void); -static void HBlankCB_Phase2_Swirl(void); -static void VBlankCB_Phase2_Shuffle(void); -static void HBlankCB_Phase2_Shuffle(void); -static void VBlankCB0_Phase2_BigPokeball(void); -static void VBlankCB1_Phase2_BigPokeball(void); -static void VBlankCB_Phase2_Clockwise_BlackFade(void); -static void VBlankCB_Phase2_Ripple(void); -static void HBlankCB_Phase2_Ripple(void); -static void VBlankCB_Phase2_30(void); -static void HBlankCB_Phase2_30(void); -static void VBlankCB_Phase2_Wave(void); -static void VBlankCB_Phase2_Slice(void); -static void HBlankCB_Phase2_Slice(void); -static void VBlankCB0_Phase2_WhiteFade(void); -static void VBlankCB1_Phase2_WhiteFade(void); -static void HBlankCB_Phase2_WhiteFade(void); -static void VBlankCB_Phase2_Shards(void); -static void VBlankCB_Phase2_Rayquaza(void); -static bool8 Phase2_Blur_Func1(struct Task *task); -static bool8 Phase2_Blur_Func2(struct Task *task); -static bool8 Phase2_Blur_Func3(struct Task *task); -static bool8 Phase2_Swirl_Func1(struct Task *task); -static bool8 Phase2_Swirl_Func2(struct Task *task); -static bool8 Phase2_Shuffle_Func1(struct Task *task); -static bool8 Phase2_Shuffle_Func2(struct Task *task); -static bool8 Phase2_Aqua_Func1(struct Task *task); -static bool8 Phase2_Aqua_Func2(struct Task *task); -static bool8 Phase2_Magma_Func1(struct Task *task); -static bool8 Phase2_Magma_Func2(struct Task *task); -static bool8 Phase2_FramesCountdown(struct Task *task); -static bool8 Phase2_Regi_Func1(struct Task *task); -static bool8 Phase2_Regice_Func2(struct Task *task); -static bool8 Phase2_Registeel_Func2(struct Task *task); -static bool8 Phase2_Regirock_Func2(struct Task *task); -static bool8 Phase2_WeatherTrio_Func1(struct Task *task); -static bool8 Phase2_WaitPaletteFade(struct Task *task); -static bool8 Phase2_Kyogre_Func3(struct Task *task); -static bool8 Phase2_Kyogre_Func4(struct Task *task); -static bool8 Phase2_Kyogre_Func5(struct Task *task); -static bool8 Phase2_Groudon_Func3(struct Task *task); -static bool8 Phase2_Groudon_Func4(struct Task *task); -static bool8 Phase2_Groudon_Func5(struct Task *task); -static bool8 Phase2_WeatherDuo_Func6(struct Task *task); -static bool8 Phase2_WeatherDuo_Func7(struct Task *task); -static bool8 Phase2_BigPokeball_Func1(struct Task *task); -static bool8 Phase2_BigPokeball_Func2(struct Task *task); -static bool8 Phase2_BigPokeball_Func3(struct Task *task); -static bool8 Phase2_BigPokeball_Func4(struct Task *task); -static bool8 Phase2_BigPokeball_Func5(struct Task *task); -static bool8 Phase2_BigPokeball_Func6(struct Task *task); -static bool8 Phase2_PokeballsTrail_Func1(struct Task *task); -static bool8 Phase2_PokeballsTrail_Func2(struct Task *task); -static bool8 Phase2_PokeballsTrail_Func3(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task); -static bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task); -static bool8 Phase2_Ripple_Func1(struct Task *task); -static bool8 Phase2_Ripple_Func2(struct Task *task); -static bool8 Phase2_Wave_Func1(struct Task *task); -static bool8 Phase2_Wave_Func2(struct Task *task); -static bool8 Phase2_Wave_Func3(struct Task *task); -static bool8 Phase2_Slice_Func1(struct Task *task); -static bool8 Phase2_Slice_Func2(struct Task *task); -static bool8 Phase2_Slice_Func3(struct Task *task); -static bool8 Phase2_WhiteFade_Func1(struct Task *task); -static bool8 Phase2_WhiteFade_Func2(struct Task *task); -static bool8 Phase2_WhiteFade_Func3(struct Task *task); -static bool8 Phase2_WhiteFade_Func4(struct Task *task); -static bool8 Phase2_WhiteFade_Func5(struct Task *task); -static bool8 Phase2_GridSquares_Func1(struct Task *task); -static bool8 Phase2_GridSquares_Func2(struct Task *task); -static bool8 Phase2_GridSquares_Func3(struct Task *task); -static bool8 Phase2_Shards_Func1(struct Task *task); -static bool8 Phase2_Shards_Func2(struct Task *task); -static bool8 Phase2_Shards_Func3(struct Task *task); -static bool8 Phase2_Shards_Func4(struct Task *task); -static bool8 Phase2_Shards_Func5(struct Task *task); -static bool8 Phase2_ShredSplit_Func1(struct Task *task); -static bool8 Phase2_ShredSplit_Func2(struct Task *task); -static bool8 Phase2_ShredSplit_Func3(struct Task *task); -static bool8 Phase2_ShredSplit_Func4(struct Task *task); -static bool8 Phase2_Blackhole_Func1(struct Task *task); -static bool8 Phase2_Blackhole1_Func2(struct Task *task); -static bool8 Phase2_Blackhole1_Func3(struct Task *task); -static bool8 Phase2_Blackhole2_Func2(struct Task *task); -static bool8 Phase2_RectangularSpiral_Func1(struct Task *task); -static bool8 Phase2_RectangularSpiral_Func2(struct Task *task); -static bool8 Phase2_RectangularSpiral_Func3(struct Task *task); -static bool8 Phase2_FrontierLogoWiggle_Func1(struct Task *task); -static bool8 Phase2_FrontierLogoWiggle_Func2(struct Task *task); -static bool8 Phase2_FrontierLogoWave_Func1(struct Task *task); -static bool8 Phase2_FrontierLogoWave_Func2(struct Task *task); -static bool8 Phase2_FrontierLogoWave_Func3(struct Task *task); -static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task); -static bool8 Phase2_Rayquaza_Func3(struct Task *task); -static bool8 Phase2_Rayquaza_Func4(struct Task *task); -static bool8 Phase2_Rayquaza_Func5(struct Task *task); -static bool8 Phase2_Rayquaza_Func6(struct Task *task); -static bool8 Phase2_Rayquaza_Func7(struct Task *task); -static bool8 Phase2_Rayquaza_Func8(struct Task *task); -static bool8 Phase2_Rayquaza_Func9(struct Task *task); -static bool8 Phase2_FrontierSquares_Func1(struct Task *task); -static bool8 Phase2_FrontierSquares_Func2(struct Task *task); -static bool8 Phase2_FrontierSquares_Func3(struct Task *task); -static bool8 Phase2_FrontierSquares_End(struct Task *task); -static bool8 Phase2_FrontierSquaresSpiral_Func1(struct Task *task); -static bool8 Phase2_FrontierSquaresSpiral_Func2(struct Task *task); -static bool8 Phase2_FrontierSquaresSpiral_Func3(struct Task *task); -static bool8 Phase2_FrontierSquaresSpiral_Func4(struct Task *task); -static bool8 Phase2_FrontierSquaresScroll_Func1(struct Task *task); -static bool8 Phase2_FrontierSquaresScroll_Func2(struct Task *task); -static bool8 Phase2_FrontierSquaresScroll_Func3(struct Task *task); -static bool8 Phase2_FrontierSquaresScroll_Func4(struct Task *task); -static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task); -static bool8 Phase2_Mugshot_Func1(struct Task *task); -static bool8 Phase2_Mugshot_Func2(struct Task *task); -static bool8 Phase2_Mugshot_Func3(struct Task *task); -static bool8 Phase2_Mugshot_Func4(struct Task *task); -static bool8 Phase2_Mugshot_Func5(struct Task *task); -static bool8 Phase2_Mugshot_Func6(struct Task *task); -static bool8 Phase2_Mugshot_Func7(struct Task *task); -static bool8 Phase2_Mugshot_Func8(struct Task *task); -static bool8 Phase2_Mugshot_Func9(struct Task *task); -static bool8 Phase2_Mugshot_Func10(struct Task *task); -static void Phase2Task_MugShotTransition(u8 taskId); -static void Mugshots_CreateOpponentPlayerSprites(struct Task *task); -static void VBlankCB0_Phase2_Mugshots(void); -static void VBlankCB1_Phase2_Mugshots(void); -static void HBlankCB_Phase2_Mugshots(void); -static bool8 Transition_Phase1(struct Task *task); -static bool8 Transition_WaitForPhase1(struct Task *task); -static bool8 Transition_Phase2(struct Task *task); -static bool8 Transition_WaitForPhase2(struct Task *task); -static void InitTransitionStructVars(void); +static void VBlankCB_Swirl(void); +static void HBlankCB_Swirl(void); +static void VBlankCB_Shuffle(void); +static void HBlankCB_Shuffle(void); +static void VBlankCB_PatternWeave(void); +static void VBlankCB_CircularMask(void); +static void VBlankCB_ClockwiseWipe(void); +static void VBlankCB_Ripple(void); +static void HBlankCB_Ripple(void); +static void VBlankCB_FrontierLogoWave(void); +static void HBlankCB_FrontierLogoWave(void); +static void VBlankCB_Wave(void); +static void VBlankCB_Slice(void); +static void HBlankCB_Slice(void); +static void VBlankCB_WhiteBarsFade(void); +static void VBlankCB_WhiteBarsFade_Blend(void); +static void HBlankCB_WhiteBarsFade(void); +static void VBlankCB_AngledWipes(void); +static void VBlankCB_Rayquaza(void); +static bool8 Blur_Init(struct Task *); +static bool8 Blur_Main(struct Task *); +static bool8 Blur_End(struct Task *); +static bool8 Swirl_Init(struct Task *); +static bool8 Swirl_End(struct Task *); +static bool8 Shuffle_Init(struct Task *); +static bool8 Shuffle_End(struct Task *); +static bool8 Aqua_Init(struct Task *); +static bool8 Aqua_SetGfx(struct Task *); +static bool8 Magma_Init(struct Task *); +static bool8 Magma_SetGfx(struct Task *); +static bool8 FramesCountdown(struct Task *); +static bool8 Regi_Init(struct Task *); +static bool8 Regice_SetGfx(struct Task *); +static bool8 Registeel_SetGfx(struct Task *); +static bool8 Regirock_SetGfx(struct Task *); +static bool8 WeatherTrio_BgFadeBlack(struct Task *); +static bool8 WeatherTrio_WaitFade(struct Task *); +static bool8 Kyogre_Init(struct Task *); +static bool8 Kyogre_PaletteFlash(struct Task *); +static bool8 Kyogre_PaletteBrighten(struct Task *); +static bool8 Groudon_Init(struct Task *); +static bool8 Groudon_PaletteFlash(struct Task *); +static bool8 Groudon_PaletteBrighten(struct Task *); +static bool8 WeatherDuo_FadeOut(struct Task *); +static bool8 WeatherDuo_End(struct Task *); +static bool8 BigPokeball_Init(struct Task *); +static bool8 BigPokeball_SetGfx(struct Task *); +static bool8 PatternWeave_Blend1(struct Task *); +static bool8 PatternWeave_Blend2(struct Task *); +static bool8 PatternWeave_FinishAppear(struct Task *); +static bool8 PatternWeave_CircularMask(struct Task *); +static bool8 PokeballsTrail_Init(struct Task *); +static bool8 PokeballsTrail_Main(struct Task *); +static bool8 PokeballsTrail_End(struct Task *); +static bool8 ClockwiseWipe_Init(struct Task *); +static bool8 ClockwiseWipe_TopRight(struct Task *); +static bool8 ClockwiseWipe_Right(struct Task *); +static bool8 ClockwiseWipe_Bottom(struct Task *); +static bool8 ClockwiseWipe_Left(struct Task *); +static bool8 ClockwiseWipe_TopLeft(struct Task *); +static bool8 ClockwiseWipe_End(struct Task *); +static bool8 Ripple_Init(struct Task *); +static bool8 Ripple_Main(struct Task *); +static bool8 Wave_Init(struct Task *); +static bool8 Wave_Main(struct Task *); +static bool8 Wave_End(struct Task *); +static bool8 Slice_Init(struct Task *); +static bool8 Slice_Main(struct Task *); +static bool8 Slice_End(struct Task *); +static bool8 WhiteBarsFade_Init(struct Task *); +static bool8 WhiteBarsFade_StartBars(struct Task *); +static bool8 WhiteBarsFade_WaitBars(struct Task *); +static bool8 WhiteBarsFade_BlendToBlack(struct Task *); +static bool8 WhiteBarsFade_End(struct Task *); +static bool8 GridSquares_Init(struct Task *); +static bool8 GridSquares_Main(struct Task *); +static bool8 GridSquares_End(struct Task *); +static bool8 AngledWipes_Init(struct Task *); +static bool8 AngledWipes_SetWipeData(struct Task *); +static bool8 AngledWipes_DoWipe(struct Task *); +static bool8 AngledWipes_TryEnd(struct Task *); +static bool8 AngledWipes_StartNext(struct Task *); +static bool8 ShredSplit_Init(struct Task *); +static bool8 ShredSplit_Main(struct Task *); +static bool8 ShredSplit_BrokenCheck(struct Task *); +static bool8 ShredSplit_End(struct Task *); +static bool8 Blackhole_Init(struct Task *); +static bool8 Blackhole_Vibrate(struct Task *); +static bool8 Blackhole_GrowEnd(struct Task *); +static bool8 BlackholePulsate_Main(struct Task *); +static bool8 RectangularSpiral_Init(struct Task *); +static bool8 RectangularSpiral_Main(struct Task *); +static bool8 RectangularSpiral_End(struct Task *); +static bool8 FrontierLogoWiggle_Init(struct Task *); +static bool8 FrontierLogoWiggle_SetGfx(struct Task *); +static bool8 FrontierLogoWave_Init(struct Task *); +static bool8 FrontierLogoWave_SetGfx(struct Task *); +static bool8 FrontierLogoWave_InitScanline(struct Task *); +static bool8 FrontierLogoWave_Main(struct Task *); +static bool8 Rayquaza_Init(struct Task *); +static bool8 Rayquaza_SetGfx(struct Task *); +static bool8 Rayquaza_PaletteFlash(struct Task *); +static bool8 Rayquaza_FadeToBlack(struct Task *); +static bool8 Rayquaza_WaitFade(struct Task *); +static bool8 Rayquaza_SetBlack(struct Task *); +static bool8 Rayquaza_TriRing(struct Task *); +static bool8 FrontierSquares_Init(struct Task *); +static bool8 FrontierSquares_Draw(struct Task *); +static bool8 FrontierSquares_Shrink(struct Task *); +static bool8 FrontierSquares_End(struct Task *); +static bool8 FrontierSquaresSpiral_Init(struct Task *); +static bool8 FrontierSquaresSpiral_Outward(struct Task *); +static bool8 FrontierSquaresSpiral_SetBlack(struct Task *); +static bool8 FrontierSquaresSpiral_Inward(struct Task *); +static bool8 FrontierSquaresScroll_Init(struct Task *); +static bool8 FrontierSquaresScroll_Draw(struct Task *); +static bool8 FrontierSquaresScroll_SetBlack(struct Task *); +static bool8 FrontierSquaresScroll_Erase(struct Task *); +static bool8 FrontierSquaresScroll_End(struct Task *); +static bool8 Mugshot_Init(struct Task *); +static bool8 Mugshot_SetGfx(struct Task *); +static bool8 Mugshot_ShowBanner(struct Task *); +static bool8 Mugshot_StartOpponentSlide(struct Task *); +static bool8 Mugshot_WaitStartPlayerSlide(struct Task *); +static bool8 Mugshot_WaitPlayerSlide(struct Task *); +static bool8 Mugshot_GradualWhiteFade(struct Task *); +static bool8 Mugshot_InitFadeWhiteToBlack(struct Task *); +static bool8 Mugshot_FadeToBlack(struct Task *); +static bool8 Mugshot_End(struct Task *); +static void DoMugshotTransition(u8); +static void Mugshots_CreateTrainerPics(struct Task *); +static void VBlankCB_Mugshots(void); +static void VBlankCB_MugshotsFadeOut(void); +static void HBlankCB_Mugshots(void); +static void InitTransitionData(void); static void FadeScreenBlack(void); -static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4); -static void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3); -static void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize); -static void GetBg0TilemapDst(u16 **tileset); -static void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6); -static bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2); -static void SetTrainerPicSlideTable(s16 spriteId, s16 arrId); -static void IncrementTrainerPicState(s16 spriteId); -static s16 IsTrainerPicSlideDone(s16 spriteId); -static bool8 Phase1_TransitionAll_Func1(struct Task *task); -static bool8 Phase1_TransitionAll_Func2(struct Task *task); -static bool8 IsPhase1Done(void); -static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1); -static void sub_814713C(struct Sprite *sprite); -static void SpriteCb_TrainerPic(struct Sprite *sprite); -static void sub_8149864(struct Sprite *sprite); -static bool8 TrainerPicCb_Nothing(struct Sprite *sprite); -static bool8 TrainerPicCb_SetSlideOffsets(struct Sprite *sprite); -static bool8 TrainerPicCb_Slide1(struct Sprite *sprite); -static bool8 TrainerPicCb_Slide2(struct Sprite *sprite); -static bool8 TrainerPicCb_Slide3(struct Sprite *sprite); - -// iwram bss vars -static s16 sUnusedRectangularSpiralVar; +static void CreateIntroTask(s16, s16, s16, s16, s16); +static void SetCircularMask(u16 *, s16, s16, s16); +static void SetSinWave(s16 *, s16, s16, s16, s16, s16); +static void GetBg0TilemapDst(u16 **); +static void InitBlackWipe(s16 *, s16, s16, s16, s16, s16, s16); +static bool8 UpdateBlackWipe(s16 *, bool8, bool8); +static void SetTrainerPicSlideDirection(s16, s16); +static void IncrementTrainerPicState(s16); +static s16 IsTrainerPicSlideDone(s16); +static bool8 TransitionIntro_FadeToGray(struct Task *); +static bool8 TransitionIntro_FadeFromGray(struct Task *); +static bool8 IsIntroTaskDone(void); +static bool16 UpdateRectangularSpiralLine(const s16 * const *, struct RectangularSpiralLine *); +static void SpriteCB_FldEffPokeballTrail(struct Sprite *); +static void SpriteCB_MugshotTrainerPic(struct Sprite *); +static void SpriteCB_WhiteBarFade(struct Sprite *); +static bool8 MugshotTrainerPic_Pause(struct Sprite *); +static bool8 MugshotTrainerPic_Init(struct Sprite *); +static bool8 MugshotTrainerPic_Slide(struct Sprite *); +static bool8 MugshotTrainerPic_SlideSlow(struct Sprite *); +static bool8 MugshotTrainerPic_SlideOffscreen(struct Sprite *); + +static s16 sDebug_RectangularSpiralData; static u8 sTestingTransitionId; static u8 sTestingTransitionState; -static struct StructRectangularSpiral sRectangularSpiralTransition[4]; +static struct RectangularSpiralLine sRectangularSpiralLines[4]; -// ewram vars -EWRAM_DATA static struct TransitionData *sTransitionStructPtr = NULL; +EWRAM_DATA static struct TransitionData *sTransitionData = NULL; -// const rom data static const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp"); static const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp"); static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/battle_transitions/pokeball.4bpp"); @@ -290,7 +314,7 @@ static const u16 sRegirock_Palette[] = INCBIN_U16("graphics/battle_transitions/r static const u32 sRegice_Tilemap[] = INCBIN_U32("graphics/battle_transitions/regice.bin"); static const u32 sRegisteel_Tilemap[] = INCBIN_U32("graphics/battle_transitions/registeel.bin"); static const u32 sRegirock_Tilemap[] = INCBIN_U32("graphics/battle_transitions/regirock.bin"); -static const u16 gUnknown_085BDB14[] = INCBIN_U16("graphics/battle_transitions/85BDB14.gbapal"); +static const u16 sUnused_Palette[] = INCBIN_U16("graphics/battle_transitions/unused.gbapal"); static const u32 sKyogre_Tileset[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz"); static const u32 sKyogre_Tilemap[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz"); static const u32 sGroudon_Tileset[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz"); @@ -312,213 +336,217 @@ static const u32 sFrontierSquares_Shrink1_Tileset[] = INCBIN_U32("graphics/battl static const u32 sFrontierSquares_Shrink2_Tileset[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz"); static const u32 sFrontierSquares_Tilemap[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin"); -static const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] = +// All battle transitions use the same intro +static const TaskFunc sTasks_Intro[B_TRANSITION_COUNT] = { - [0 ... B_TRANSITION_COUNT - 1] = &Phase1Task_TransitionAll + [0 ... B_TRANSITION_COUNT - 1] = &Task_Intro }; -static const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = -{ - [B_TRANSITION_BLUR] = Phase2Task_Blur, - [B_TRANSITION_SWIRL] = Phase2Task_Swirl, - [B_TRANSITION_SHUFFLE] = Phase2Task_Shuffle, - [B_TRANSITION_BIG_POKEBALL] = Phase2Task_BigPokeball, - [B_TRANSITION_POKEBALLS_TRAIL] = Phase2Task_PokeballsTrail, - [B_TRANSITION_CLOCKWISE_BLACKFADE] = Phase2Task_Clockwise_BlackFade, - [B_TRANSITION_RIPPLE] = Phase2Task_Ripple, - [B_TRANSITION_WAVE] = Phase2Task_Wave, - [B_TRANSITION_SLICE] = Phase2Task_Slice, - [B_TRANSITION_WHITEFADE] = Phase2Task_WhiteFade, - [B_TRANSITION_GRID_SQUARES] = Phase2Task_GridSquares, - [B_TRANSITION_SHARDS] = Phase2Task_Shards, - [B_TRANSITION_SIDNEY] = Phase2Task_Sidney, - [B_TRANSITION_PHOEBE] = Phase2Task_Phoebe, - [B_TRANSITION_GLACIA] = Phase2Task_Glacia, - [B_TRANSITION_DRAKE] = Phase2Task_Drake, - [B_TRANSITION_CHAMPION] = Phase2Task_Champion, - [B_TRANSITION_AQUA] = Phase2Task_Aqua, - [B_TRANSITION_MAGMA] = Phase2Task_Magma, - [B_TRANSITION_REGICE] = Phase2Task_Regice, - [B_TRANSITION_REGISTEEL] = Phase2Task_Registeel, - [B_TRANSITION_REGIROCK] = Phase2Task_Regirock, - [B_TRANSITION_KYOGRE] = Phase2Task_Kyogre, - [B_TRANSITION_GROUDON] = Phase2Task_Groudon, - [B_TRANSITION_RAYQUAZA] = Phase2Task_Rayquaza, - [B_TRANSITION_SHRED_SPLIT] = Phase2Task_ShredSplit, - [B_TRANSITION_BLACKHOLE1] = Phase2Task_Blackhole1, - [B_TRANSITION_BLACKHOLE2] = Phase2Task_Blackhole2, - [B_TRANSITION_RECTANGULAR_SPIRAL] = Phase2Task_RectangularSpiral, - [B_TRANSITION_FRONTIER_LOGO_WIGGLE] = Phase2Task_FrontierLogoWiggle, - [B_TRANSITION_FRONTIER_LOGO_WAVE] = Phase2Task_FrontierLogoWave, - [B_TRANSITION_FRONTIER_SQUARES] = Phase2Task_FrontierSquares, - [B_TRANSITION_FRONTIER_SQUARES_SCROLL] = Phase2Task_FrontierSquaresScroll, - [B_TRANSITION_FRONTIER_SQUARES_SPIRAL] = Phase2Task_FrontierSquaresSpiral, - [B_TRANSITION_FRONTIER_CIRCLES_MEET] = Phase2Task_FrontierCirclesMeet, - [B_TRANSITION_FRONTIER_CIRCLES_CROSS] = Phase2Task_FrontierCirclesCross, - [B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL] = Phase2Task_FrontierCirclesAsymmetricSpiral, - [B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL] = Phase2Task_FrontierCirclesSymmetricSpiral, - [B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ] = Phase2Task_FrontierCirclesMeetInSeq, - [B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ] = Phase2Task_FrontierCirclesCrossInSeq, - [B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ] = Phase2Task_FrontierCirclesAsymmetricSpiralInSeq, - [B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ] = Phase2Task_FrontierCirclesSymmetricSpiralInSeq, +// After the intro each transition has a unique main task. +// This task will call the functions that do the transition effects. +static const TaskFunc sTasks_Main[B_TRANSITION_COUNT] = +{ + [B_TRANSITION_BLUR] = Task_Blur, + [B_TRANSITION_SWIRL] = Task_Swirl, + [B_TRANSITION_SHUFFLE] = Task_Shuffle, + [B_TRANSITION_BIG_POKEBALL] = Task_BigPokeball, + [B_TRANSITION_POKEBALLS_TRAIL] = Task_PokeballsTrail, + [B_TRANSITION_CLOCKWISE_WIPE] = Task_ClockwiseWipe, + [B_TRANSITION_RIPPLE] = Task_Ripple, + [B_TRANSITION_WAVE] = Task_Wave, + [B_TRANSITION_SLICE] = Task_Slice, + [B_TRANSITION_WHITE_BARS_FADE] = Task_WhiteBarsFade, + [B_TRANSITION_GRID_SQUARES] = Task_GridSquares, + [B_TRANSITION_ANGLED_WIPES] = Task_AngledWipes, + [B_TRANSITION_SIDNEY] = Task_Sidney, + [B_TRANSITION_PHOEBE] = Task_Phoebe, + [B_TRANSITION_GLACIA] = Task_Glacia, + [B_TRANSITION_DRAKE] = Task_Drake, + [B_TRANSITION_CHAMPION] = Task_Champion, + [B_TRANSITION_AQUA] = Task_Aqua, + [B_TRANSITION_MAGMA] = Task_Magma, + [B_TRANSITION_REGICE] = Task_Regice, + [B_TRANSITION_REGISTEEL] = Task_Registeel, + [B_TRANSITION_REGIROCK] = Task_Regirock, + [B_TRANSITION_KYOGRE] = Task_Kyogre, + [B_TRANSITION_GROUDON] = Task_Groudon, + [B_TRANSITION_RAYQUAZA] = Task_Rayquaza, + [B_TRANSITION_SHRED_SPLIT] = Task_ShredSplit, + [B_TRANSITION_BLACKHOLE] = Task_Blackhole, + [B_TRANSITION_BLACKHOLE_PULSATE] = Task_BlackholePulsate, + [B_TRANSITION_RECTANGULAR_SPIRAL] = Task_RectangularSpiral, + [B_TRANSITION_FRONTIER_LOGO_WIGGLE] = Task_FrontierLogoWiggle, + [B_TRANSITION_FRONTIER_LOGO_WAVE] = Task_FrontierLogoWave, + [B_TRANSITION_FRONTIER_SQUARES] = Task_FrontierSquares, + [B_TRANSITION_FRONTIER_SQUARES_SCROLL] = Task_FrontierSquaresScroll, + [B_TRANSITION_FRONTIER_SQUARES_SPIRAL] = Task_FrontierSquaresSpiral, + [B_TRANSITION_FRONTIER_CIRCLES_MEET] = Task_FrontierCirclesMeet, + [B_TRANSITION_FRONTIER_CIRCLES_CROSS] = Task_FrontierCirclesCross, + [B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL] = Task_FrontierCirclesAsymmetricSpiral, + [B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL] = Task_FrontierCirclesSymmetricSpiral, + [B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ] = Task_FrontierCirclesMeetInSeq, + [B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ] = Task_FrontierCirclesCrossInSeq, + [B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ] = Task_FrontierCirclesAsymmetricSpiralInSeq, + [B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ] = Task_FrontierCirclesSymmetricSpiralInSeq, }; -static const TransitionStateFunc sMainTransitionPhases[] = +static const TransitionStateFunc sTaskHandlers[] = { - &Transition_Phase1, - &Transition_WaitForPhase1, - &Transition_Phase2, - &Transition_WaitForPhase2 + &Transition_StartIntro, + &Transition_WaitForIntro, + &Transition_StartMain, + &Transition_WaitForMain }; -static const TransitionStateFunc sPhase2_Blur_Funcs[] = +static const TransitionStateFunc sBlur_Funcs[] = { - Phase2_Blur_Func1, - Phase2_Blur_Func2, - Phase2_Blur_Func3 + Blur_Init, + Blur_Main, + Blur_End }; -static const TransitionStateFunc sPhase2_Swirl_Funcs[] = +static const TransitionStateFunc sSwirl_Funcs[] = { - Phase2_Swirl_Func1, - Phase2_Swirl_Func2, + Swirl_Init, + Swirl_End, }; -static const TransitionStateFunc sPhase2_Shuffle_Funcs[] = +static const TransitionStateFunc sShuffle_Funcs[] = { - Phase2_Shuffle_Func1, - Phase2_Shuffle_Func2, + Shuffle_Init, + Shuffle_End, }; -static const TransitionStateFunc sPhase2_Aqua_Funcs[] = +static const TransitionStateFunc sAqua_Funcs[] = { - Phase2_Aqua_Func1, - Phase2_Aqua_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_FramesCountdown, - Phase2_BigPokeball_Func6 + Aqua_Init, + Aqua_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + FramesCountdown, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_Magma_Funcs[] = +static const TransitionStateFunc sMagma_Funcs[] = { - Phase2_Magma_Func1, - Phase2_Magma_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_FramesCountdown, - Phase2_BigPokeball_Func6 + Magma_Init, + Magma_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + FramesCountdown, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_BigPokeball_Funcs[] = +static const TransitionStateFunc sBigPokeball_Funcs[] = { - Phase2_BigPokeball_Func1, - Phase2_BigPokeball_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_BigPokeball_Func6 + BigPokeball_Init, + BigPokeball_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_Regice_Funcs[] = +static const TransitionStateFunc sRegice_Funcs[] = { - Phase2_Regi_Func1, - Phase2_Regice_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_BigPokeball_Func6 + Regi_Init, + Regice_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_Registeel_Funcs[] = +static const TransitionStateFunc sRegisteel_Funcs[] = { - Phase2_Regi_Func1, - Phase2_Registeel_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_BigPokeball_Func6 + Regi_Init, + Registeel_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_Regirock_Funcs[] = +static const TransitionStateFunc sRegirock_Funcs[] = { - Phase2_Regi_Func1, - Phase2_Regirock_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_BigPokeball_Func6 + Regi_Init, + Regirock_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_Kyogre_Funcs[] = +static const TransitionStateFunc sKyogre_Funcs[] = { - Phase2_WeatherTrio_Func1, - Phase2_WaitPaletteFade, - Phase2_Kyogre_Func3, - Phase2_Kyogre_Func4, - Phase2_Kyogre_Func5, - Phase2_FramesCountdown, - Phase2_WeatherDuo_Func6, - Phase2_WeatherDuo_Func7 + WeatherTrio_BgFadeBlack, + WeatherTrio_WaitFade, + Kyogre_Init, + Kyogre_PaletteFlash, + Kyogre_PaletteBrighten, + FramesCountdown, + WeatherDuo_FadeOut, + WeatherDuo_End }; -static const TransitionStateFunc sPhase2_PokeballsTrail_Funcs[] = +static const TransitionStateFunc sPokeballsTrail_Funcs[] = { - Phase2_PokeballsTrail_Func1, - Phase2_PokeballsTrail_Func2, - Phase2_PokeballsTrail_Func3 + PokeballsTrail_Init, + PokeballsTrail_Main, + PokeballsTrail_End }; -static const s16 sUnknown_085C8B88[2] = {-16, 256}; -static const s16 sUnknown_085C8B8C[5] = {0, 32, 64, 18, 48}; -static const s16 sUnknown_085C8B96[2] = {8, -8}; +#define NUM_POKEBALL_TRAILS 5 +static const s16 sPokeballsTrail_StartXCoords[2] = { -16, DISPLAY_WIDTH + 16 }; +static const s16 sPokeballsTrail_Delays[NUM_POKEBALL_TRAILS] = {0, 32, 64, 18, 48}; +static const s16 sPokeballsTrail_Speeds[2] = {8, -8}; -static const TransitionStateFunc sPhase2_Clockwise_BlackFade_Funcs[] = +static const TransitionStateFunc sClockwiseWipe_Funcs[] = { - Phase2_Clockwise_BlackFade_Func1, - Phase2_Clockwise_BlackFade_Func2, - Phase2_Clockwise_BlackFade_Func3, - Phase2_Clockwise_BlackFade_Func4, - Phase2_Clockwise_BlackFade_Func5, - Phase2_Clockwise_BlackFade_Func6, - Phase2_Clockwise_BlackFade_Func7 + ClockwiseWipe_Init, + ClockwiseWipe_TopRight, + ClockwiseWipe_Right, + ClockwiseWipe_Bottom, + ClockwiseWipe_Left, + ClockwiseWipe_TopLeft, + ClockwiseWipe_End }; -static const TransitionStateFunc sPhase2_Ripple_Funcs[] = +static const TransitionStateFunc sRipple_Funcs[] = { - Phase2_Ripple_Func1, - Phase2_Ripple_Func2 + Ripple_Init, + Ripple_Main }; -static const TransitionStateFunc sPhase2_Wave_Funcs[] = +static const TransitionStateFunc sWave_Funcs[] = { - Phase2_Wave_Func1, - Phase2_Wave_Func2, - Phase2_Wave_Func3 + Wave_Init, + Wave_Main, + Wave_End }; -static const TransitionStateFunc sPhase2_Mugshot_Funcs[] = -{ - Phase2_Mugshot_Func1, - Phase2_Mugshot_Func2, - Phase2_Mugshot_Func3, - Phase2_Mugshot_Func4, - Phase2_Mugshot_Func5, - Phase2_Mugshot_Func6, - Phase2_Mugshot_Func7, - Phase2_Mugshot_Func8, - Phase2_Mugshot_Func9, - Phase2_Mugshot_Func10 +static const TransitionStateFunc sMugshot_Funcs[] = +{ + Mugshot_Init, + Mugshot_SetGfx, + Mugshot_ShowBanner, + Mugshot_StartOpponentSlide, + Mugshot_WaitStartPlayerSlide, + Mugshot_WaitPlayerSlide, + Mugshot_GradualWhiteFade, + Mugshot_InitFadeWhiteToBlack, + Mugshot_FadeToBlack, + Mugshot_End }; static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] = { - [MUGSHOT_SIDNEY] = TRAINER_PIC_ELITE_FOUR_SIDNEY, - [MUGSHOT_PHOEBE] = TRAINER_PIC_ELITE_FOUR_PHOEBE, - [MUGSHOT_GLACIA] = TRAINER_PIC_ELITE_FOUR_GLACIA, - [MUGSHOT_DRAKE] = TRAINER_PIC_ELITE_FOUR_DRAKE, + [MUGSHOT_SIDNEY] = TRAINER_PIC_ELITE_FOUR_SIDNEY, + [MUGSHOT_PHOEBE] = TRAINER_PIC_ELITE_FOUR_PHOEBE, + [MUGSHOT_GLACIA] = TRAINER_PIC_ELITE_FOUR_GLACIA, + [MUGSHOT_DRAKE] = TRAINER_PIC_ELITE_FOUR_DRAKE, [MUGSHOT_CHAMPION] = TRAINER_PIC_CHAMPION_WALLACE, }; static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = @@ -531,185 +559,222 @@ static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = }; static const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] = { - [MUGSHOT_SIDNEY] = {0, 0}, - [MUGSHOT_PHOEBE] = {0, 0}, - [MUGSHOT_GLACIA] = {-4, 4}, - [MUGSHOT_DRAKE] = {0, 5}, - [MUGSHOT_CHAMPION] = {-8, 7}, + [MUGSHOT_SIDNEY] = { 0, 0}, + [MUGSHOT_PHOEBE] = { 0, 0}, + [MUGSHOT_GLACIA] = {-4, 4}, + [MUGSHOT_DRAKE] = { 0, 5}, + [MUGSHOT_CHAMPION] = {-8, 7}, }; -static const TransitionSpriteCallback sTrainerPicSpriteCbs[] = +static const TransitionSpriteCallback sMugshotTrainerPicFuncs[] = { - TrainerPicCb_Nothing, - TrainerPicCb_SetSlideOffsets, - TrainerPicCb_Slide1, - TrainerPicCb_Slide2, - TrainerPicCb_Nothing, - TrainerPicCb_Slide3, - TrainerPicCb_Nothing + MugshotTrainerPic_Pause, + MugshotTrainerPic_Init, + MugshotTrainerPic_Slide, + MugshotTrainerPic_SlideSlow, + MugshotTrainerPic_Pause, + MugshotTrainerPic_SlideOffscreen, + MugshotTrainerPic_Pause }; -static const s16 sTrainerPicSlideOffsets1[2] = {12, -12}; -static const s16 sTrainerPicSlideOffsets2[2] = {-1, 1}; +// One element per slide direction. +// Sign of acceleration is opposite speed, so slide decelerates. +static const s16 sTrainerPicSlideSpeeds[2] = {12, -12}; +static const s16 sTrainerPicSlideAccels[2] = {-1, 1}; -static const TransitionStateFunc sPhase2_Slice_Funcs[] = +static const TransitionStateFunc sSlice_Funcs[] = { - Phase2_Slice_Func1, - Phase2_Slice_Func2, - Phase2_Slice_Func3 + Slice_Init, + Slice_Main, + Slice_End }; -static const TransitionStateFunc sPhase2_ShredSplit_Funcs[] = +static const TransitionStateFunc sShredSplit_Funcs[] = { - Phase2_ShredSplit_Func1, - Phase2_ShredSplit_Func2, - Phase2_ShredSplit_Func3, - Phase2_ShredSplit_Func4 + ShredSplit_Init, + ShredSplit_Main, + ShredSplit_BrokenCheck, + ShredSplit_End }; -static const u8 gUnknown_085C8C64[] = {39, 119}; -static const s16 gUnknown_085C8C66[] = {1, -1}; +static const u8 sShredSplit_SectionYCoords[] = {39, DISPLAY_HEIGHT - 41}; +static const s16 sShredSplit_SectionMoveDirs[] = {1, -1}; -static const TransitionStateFunc sPhase2_Blackhole1_Funcs[] = +static const TransitionStateFunc sBlackhole_Funcs[] = { - Phase2_Blackhole_Func1, - Phase2_Blackhole1_Func2, - Phase2_Blackhole1_Func3 + Blackhole_Init, + Blackhole_Vibrate, + Blackhole_GrowEnd }; -static const TransitionStateFunc sPhase2_Blackhole2_Funcs[] = +static const TransitionStateFunc sBlackholePulsate_Funcs[] = { - Phase2_Blackhole_Func1, - Phase2_Blackhole2_Func2 + Blackhole_Init, + BlackholePulsate_Main }; -static const s16 gUnknown_085C8C80[] = {-6, 4}; +// Blackhole rapidly alternates adding these values to the radius, +// resulting in a vibrating shrink/grow effect. +static const s16 sBlackhole_Vibrations[] = {-6, 4}; -static const TransitionStateFunc sPhase2_RectangularSpiral_Funcs[] = +static const TransitionStateFunc sRectangularSpiral_Funcs[] = { - Phase2_RectangularSpiral_Func1, - Phase2_RectangularSpiral_Func2, - Phase2_RectangularSpiral_Func3 + RectangularSpiral_Init, + RectangularSpiral_Main, + RectangularSpiral_End }; -static const s16 gUnknown_085C8C90[] = {1, 27, 275, -1}; -static const s16 gUnknown_085C8C98[] = {2, 486, -1}; -static const s16 gUnknown_085C8C9E[] = {3, 262, -1}; -static const s16 gUnknown_085C8CA4[] = {4, 507, -2}; -static const s16 gUnknown_085C8CAA[] = {1, 213, -1}; -static const s16 gUnknown_085C8CB0[] = {2, 548, -2}; -static const s16 gUnknown_085C8CB6[] = {3, 196, -1}; -static const s16 gUnknown_085C8CBC[] = {4, 573, 309, -1}; -static const s16 gUnknown_085C8CC4[] = {1, 474, -1}; -static const s16 gUnknown_085C8CCA[] = {2, 295, 32, -1}; -static const s16 gUnknown_085C8CD2[] = {3, 58, -1}; -static const s16 gUnknown_085C8CD8[] = {4, 455, -1}; -static const s16 gUnknown_085C8CDE[] = {1, 540, -1}; -static const s16 gUnknown_085C8CE4[] = {2, 229, -1}; -static const s16 gUnknown_085C8CEA[] = {3, 244, 28, -1}; -static const s16 gUnknown_085C8CF2[] = {4, 517, -1}; - -static const s16 *const gUnknown_085C8CF8[] = -{ - gUnknown_085C8C90, - gUnknown_085C8CA4, - gUnknown_085C8C98, - gUnknown_085C8C9E, - gUnknown_085C8CEA, - gUnknown_085C8CE4, - gUnknown_085C8CF2, - gUnknown_085C8CDE +#define SPIRAL_END (-1) +#define SPIRAL_REBOUND (-2) + +// Note that the directions are inverted for the lines originating at the bottom. +// i.e. MOVE_RIGHT is a right move for the top lines and a left move for the inverted bottom lines. +enum { + MOVE_RIGHT = 1, + MOVE_LEFT, + MOVE_UP, + MOVE_DOWN, +}; + +// Offsets of the movement data for spiraling in either direction. +#define SPIRAL_INWARD_START 0 +#define SPIRAL_INWARD_END 3 +#define SPIRAL_OUTWARD_START 4 +#define SPIRAL_OUTWARD_END 7 + +static const s16 sRectangularSpiral_Major_InwardRight[] = {MOVE_RIGHT, 27, 275, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_InwardLeft[] = {MOVE_LEFT, 486, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_InwardUp[] = {MOVE_UP, 262, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_InwardDown[] = {MOVE_DOWN, 507, SPIRAL_REBOUND}; + +static const s16 sRectangularSpiral_Minor_InwardRight[] = {MOVE_RIGHT, 213, SPIRAL_END}; +static const s16 sRectangularSpiral_Minor_InwardLeft[] = {MOVE_LEFT, 548, SPIRAL_REBOUND}; +static const s16 sRectangularSpiral_Minor_InwardUp[] = {MOVE_UP, 196, SPIRAL_END}; +static const s16 sRectangularSpiral_Minor_InwardDown[] = {MOVE_DOWN, 573, 309, SPIRAL_END}; + +static const s16 sRectangularSpiral_Minor_OutwardRight[] = {MOVE_RIGHT, 474, SPIRAL_END}; +static const s16 sRectangularSpiral_Minor_OutwardLeft[] = {MOVE_LEFT, 295, 32, SPIRAL_END}; +static const s16 sRectangularSpiral_Minor_OutwardUp[] = {MOVE_UP, 58, SPIRAL_END}; +static const s16 sRectangularSpiral_Minor_OutwardDown[] = {MOVE_DOWN, 455, SPIRAL_END}; + +static const s16 sRectangularSpiral_Major_OutwardRight[] = {MOVE_RIGHT, 540, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_OutwardLeft[] = {MOVE_LEFT, 229, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_OutwardUp[] = {MOVE_UP, 244, 28, SPIRAL_END}; +static const s16 sRectangularSpiral_Major_OutwardDown[] = {MOVE_DOWN, 517, SPIRAL_END}; + +// Move data for spiral lines starting in the top left / bottom right +static const s16 *const sRectangularSpiral_MoveDataTable_MajorDiagonal[] = +{ + [SPIRAL_INWARD_START] = + sRectangularSpiral_Major_InwardRight, + sRectangularSpiral_Major_InwardDown, + sRectangularSpiral_Major_InwardLeft, + sRectangularSpiral_Major_InwardUp, + + [SPIRAL_OUTWARD_START] = + sRectangularSpiral_Major_OutwardUp, + sRectangularSpiral_Major_OutwardLeft, + sRectangularSpiral_Major_OutwardDown, + sRectangularSpiral_Major_OutwardRight }; -static const s16 *const gUnknown_085C8D18[] = +// Move data for spiral lines starting in the top right / bottom left +static const s16 *const sRectangularSpiral_MoveDataTable_MinorDiagonal[] = { - gUnknown_085C8CBC, - gUnknown_085C8CB0, - gUnknown_085C8CB6, - gUnknown_085C8CAA, - gUnknown_085C8CCA, - gUnknown_085C8CD8, - gUnknown_085C8CC4, - gUnknown_085C8CD2 + [SPIRAL_INWARD_START] = + sRectangularSpiral_Minor_InwardDown, + sRectangularSpiral_Minor_InwardLeft, + sRectangularSpiral_Minor_InwardUp, + sRectangularSpiral_Minor_InwardRight, + + [SPIRAL_OUTWARD_START] = + sRectangularSpiral_Minor_OutwardLeft, + sRectangularSpiral_Minor_OutwardDown, + sRectangularSpiral_Minor_OutwardRight, + sRectangularSpiral_Minor_OutwardUp }; -static const s16 *const *const gUnknown_085C8D38[] = +static const s16 *const *const sRectangularSpiral_MoveDataTables[] = { - gUnknown_085C8CF8, - gUnknown_085C8D18 + sRectangularSpiral_MoveDataTable_MajorDiagonal, + sRectangularSpiral_MoveDataTable_MinorDiagonal }; -static const TransitionStateFunc sPhase2_Groudon_Funcs[] = +static const TransitionStateFunc sGroudon_Funcs[] = { - Phase2_WeatherTrio_Func1, - Phase2_WaitPaletteFade, - Phase2_Groudon_Func3, - Phase2_Groudon_Func4, - Phase2_Groudon_Func5, - Phase2_FramesCountdown, - Phase2_WeatherDuo_Func6, - Phase2_WeatherDuo_Func7 + WeatherTrio_BgFadeBlack, + WeatherTrio_WaitFade, + Groudon_Init, + Groudon_PaletteFlash, + Groudon_PaletteBrighten, + FramesCountdown, + WeatherDuo_FadeOut, + WeatherDuo_End }; -static const TransitionStateFunc sPhase2_Rayquaza_Funcs[] = -{ - Phase2_WeatherTrio_Func1, - Phase2_WaitPaletteFade, - Phase2_Rayquaza_Func3, - Phase2_Rayquaza_Func4, - Phase2_Rayquaza_Func5, - Phase2_Rayquaza_Func6, - Phase2_Rayquaza_Func7, - Phase2_Rayquaza_Func8, - Phase2_Rayquaza_Func9, - Phase2_Blackhole1_Func2, - Phase2_Blackhole1_Func3 +static const TransitionStateFunc sRayquaza_Funcs[] = +{ + WeatherTrio_BgFadeBlack, + WeatherTrio_WaitFade, + Rayquaza_Init, + Rayquaza_SetGfx, + Rayquaza_PaletteFlash, + Rayquaza_FadeToBlack, + Rayquaza_WaitFade, + Rayquaza_SetBlack, + Rayquaza_TriRing, + Blackhole_Vibrate, + Blackhole_GrowEnd }; -static const TransitionStateFunc sPhase2_WhiteFade_Funcs[] = +static const TransitionStateFunc sWhiteBarsFade_Funcs[] = { - Phase2_WhiteFade_Func1, - Phase2_WhiteFade_Func2, - Phase2_WhiteFade_Func3, - Phase2_WhiteFade_Func4, - Phase2_WhiteFade_Func5 + WhiteBarsFade_Init, + WhiteBarsFade_StartBars, + WhiteBarsFade_WaitBars, + WhiteBarsFade_BlendToBlack, + WhiteBarsFade_End }; -static const s16 sUnknown_085C8DA0[] = {0, 20, 15, 40, 10, 25, 35, 5}; +#define NUM_WHITE_BARS 8 +static const s16 sWhiteBarsFade_StartDelays[NUM_WHITE_BARS] = {0, 20, 15, 40, 10, 25, 35, 5}; -static const TransitionStateFunc sPhase2_GridSquares_Funcs[] = +static const TransitionStateFunc sGridSquares_Funcs[] = { - Phase2_GridSquares_Func1, - Phase2_GridSquares_Func2, - Phase2_GridSquares_Func3 + GridSquares_Init, + GridSquares_Main, + GridSquares_End }; -static const TransitionStateFunc sPhase2_Shards_Funcs[] = +static const TransitionStateFunc sAngledWipes_Funcs[] = { - Phase2_Shards_Func1, - Phase2_Shards_Func2, - Phase2_Shards_Func3, - Phase2_Shards_Func4, - Phase2_Shards_Func5 + AngledWipes_Init, + AngledWipes_SetWipeData, + AngledWipes_DoWipe, + AngledWipes_TryEnd, + AngledWipes_StartNext }; -static const s16 sUnknown_085C8DD0[][5] = +#define NUM_ANGLED_WIPES 7 + +static const s16 sAngledWipes_MoveData[NUM_ANGLED_WIPES][5] = { - {56, 0, 0, 160, 0}, - {104, 160, 240, 88, 1}, - {240, 72, 56, 0, 1}, - {0, 32, 144, 160, 0}, - {144, 160, 184, 0, 1}, - {56, 0, 168, 160, 0}, - {168, 160, 48, 0, 1}, +// startX startY endX endY yDirection + {56, 0, 0, DISPLAY_HEIGHT, 0}, + {104, DISPLAY_HEIGHT, DISPLAY_WIDTH, 88, 1}, + {DISPLAY_WIDTH, 72, 56, 0, 1}, + {0, 32, 144, DISPLAY_HEIGHT, 0}, + {144, DISPLAY_HEIGHT, 184, 0, 1}, + {56, 0, 168, DISPLAY_HEIGHT, 0}, + {168, DISPLAY_HEIGHT, 48, 0, 1}, }; -static const s16 sUnknown_085C8E16[] = {8, 4, 2, 1, 1, 1, 0}; +static const s16 sAngledWipes_EndDelays[NUM_ANGLED_WIPES] = {8, 4, 2, 1, 1, 1, 0}; -static const TransitionStateFunc sPhase1_TransitionAll_Funcs[] = +static const TransitionStateFunc sTransitionIntroFuncs[] = { - Phase1_TransitionAll_Func1, - Phase1_TransitionAll_Func2 + TransitionIntro_FadeToGray, + TransitionIntro_FadeFromGray }; static const struct SpriteFrameImage sSpriteImage_Pokeball[] = @@ -749,12 +814,12 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_Pokeball[] = static const struct SpriteTemplate sSpriteTemplate_Pokeball = { .tileTag = TAG_NONE, - .paletteTag = FLDEFF_PAL_TAG_POKEBALL, + .paletteTag = FLDEFF_PAL_TAG_POKEBALL_TRAIL, .oam = &gObjectEventBaseOam_32x32, .anims = sSpriteAnimTable_Pokeball, .images = sSpriteImage_Pokeball, .affineAnims = sSpriteAffineAnimTable_Pokeball, - .callback = sub_814713C + .callback = SpriteCB_FldEffPokeballTrail }; static const struct OamData sOam_UnusedBrendanLass = @@ -798,28 +863,28 @@ static const union AnimCmd *const sSpriteAnimTable_UnusedBrendanLass[] = static const struct SpriteTemplate sSpriteTemplate_UnusedBrendan = { .tileTag = TAG_NONE, - .paletteTag = 0x100A, + .paletteTag = PALTAG_UNUSED_MUGSHOT, .oam = &sOam_UnusedBrendanLass, .anims = sSpriteAnimTable_UnusedBrendanLass, .images = sImageTable_UnusedBrendan, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCb_TrainerPic + .callback = SpriteCB_MugshotTrainerPic }; static const struct SpriteTemplate sSpriteTemplate_UnusedLass = { .tileTag = TAG_NONE, - .paletteTag = 0x100A, + .paletteTag = PALTAG_UNUSED_MUGSHOT, .oam = &sOam_UnusedBrendanLass, .anims = sSpriteAnimTable_UnusedBrendanLass, .images = sImageTable_UnusedLass, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCb_TrainerPic + .callback = SpriteCB_MugshotTrainerPic }; static const u16 sFieldEffectPal_Pokeball[] = INCBIN_U16("graphics/field_effects/palettes/pokeball.gbapal"); -const struct SpritePalette gSpritePalette_Pokeball = {sFieldEffectPal_Pokeball, FLDEFF_PAL_TAG_POKEBALL}; +const struct SpritePalette gSpritePalette_Pokeball = {sFieldEffectPal_Pokeball, FLDEFF_PAL_TAG_POKEBALL_TRAIL}; static const u16 sMugshotPal_Sidney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal"); static const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal"); @@ -845,59 +910,90 @@ static const u16 *const sPlayerMugshotsPals[GENDER_COUNT] = }; static const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal"); -static const struct SpritePalette sSpritePalette_UnusedTrainer = {sUnusedTrainerPalette, 0x100A}; +static const struct SpritePalette sSpritePalette_UnusedTrainer = {sUnusedTrainerPalette, PALTAG_UNUSED_MUGSHOT}; static const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin"); static const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin"); -static const TransitionStateFunc sPhase2_FrontierLogoWiggle_Funcs[] = +static const TransitionStateFunc sFrontierLogoWiggle_Funcs[] = { - Phase2_FrontierLogoWiggle_Func1, - Phase2_FrontierLogoWiggle_Func2, - Phase2_BigPokeball_Func3, - Phase2_BigPokeball_Func4, - Phase2_BigPokeball_Func5, - Phase2_BigPokeball_Func6 + FrontierLogoWiggle_Init, + FrontierLogoWiggle_SetGfx, + PatternWeave_Blend1, + PatternWeave_Blend2, + PatternWeave_FinishAppear, + PatternWeave_CircularMask }; -static const TransitionStateFunc sPhase2_FrontierLogoWave_Funcs[] = +static const TransitionStateFunc sFrontierLogoWave_Funcs[] = { - Phase2_FrontierLogoWave_Func1, - Phase2_FrontierLogoWave_Func2, - Phase2_FrontierLogoWave_Func3, - Phase2_FrontierLogoWave_Func4 + FrontierLogoWave_Init, + FrontierLogoWave_SetGfx, + FrontierLogoWave_InitScanline, + FrontierLogoWave_Main }; -static const TransitionStateFunc sPhase2_FrontierSquares_Funcs[] = +static const TransitionStateFunc sFrontierSquares_Funcs[] = { - Phase2_FrontierSquares_Func1, - Phase2_FrontierSquares_Func2, - Phase2_FrontierSquares_Func3, - Phase2_FrontierSquares_End + FrontierSquares_Init, + FrontierSquares_Draw, + FrontierSquares_Shrink, + FrontierSquares_End }; -static const TransitionStateFunc sPhase2_FrontierSquaresSpiral_Funcs[] = +static const TransitionStateFunc sFrontierSquaresSpiral_Funcs[] = { - Phase2_FrontierSquaresSpiral_Func1, - Phase2_FrontierSquaresSpiral_Func2, - Phase2_FrontierSquaresSpiral_Func3, - Phase2_FrontierSquaresSpiral_Func4, - Phase2_FrontierSquares_End + FrontierSquaresSpiral_Init, + FrontierSquaresSpiral_Outward, + FrontierSquaresSpiral_SetBlack, + FrontierSquaresSpiral_Inward, + FrontierSquares_End }; -static const TransitionStateFunc sPhase2_FrontierSquaresScroll_Funcs[] = +static const TransitionStateFunc sFrontierSquaresScroll_Funcs[] = { - Phase2_FrontierSquaresScroll_Func1, - Phase2_FrontierSquaresScroll_Func2, - Phase2_FrontierSquaresScroll_Func3, - Phase2_FrontierSquaresScroll_Func4, - Phase2_FrontierSquaresScroll_Func5 + FrontierSquaresScroll_Init, + FrontierSquaresScroll_Draw, + FrontierSquaresScroll_SetBlack, + FrontierSquaresScroll_Erase, + FrontierSquaresScroll_End }; -static const u8 gUnknown_085C9A30[] = {0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x10, 0x11, 0x12}; -static const u8 gUnknown_085C9A53[] = {0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15, 0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b, 0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31, 0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e, 0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d, 0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21, 0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14, 0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08, 0x00}; +#define SQUARE_SIZE 4 +#define MARGIN_SIZE 1 // Squares do not fit evenly across the width, so there is a margin on either side. +#define NUM_SQUARES_PER_ROW ((DISPLAY_WIDTH - (MARGIN_SIZE * 8 * 2)) / (SQUARE_SIZE * 8)) +#define NUM_SQUARES_PER_COL (DISPLAY_HEIGHT / (SQUARE_SIZE * 8)) +#define NUM_SQUARES (NUM_SQUARES_PER_ROW * NUM_SQUARES_PER_COL) + +// The order in which the squares should appear/disappear to create +// the spiral effect. Spiraling inward starts with the first element, +// and spiraling outward starts with the last. The positions are the +// squares numbered left-to-right top-to-bottom. +static const u8 sFrontierSquaresSpiral_Positions[NUM_SQUARES] = { + 28, 29, 30, 31, 32, 33, 34, + 27, 20, 13, 6, 5, 4, 3, + 2, 1, 0, 7, 14, 21, 22, + 23, 24, 25, 26, 19, 12, 11, + 10, 9, 8, 15, 16, 17, 18 +}; + +// In the scrolling version the squares appear/disappear in a "random" order +// dictated by the list below. +static const u8 sFrontierSquaresScroll_Positions[] = { + 0, 16, 41, 22, 44, 2, 43, 21, + 46, 27, 9, 48, 38, 5, 57, 59, + 12, 63, 35, 28, 10, 53, 7, 49, + 39, 23, 55, 1, 62, 17, 61, 30, + 6, 34, 15, 51, 32, 58, 13, 45, + 37, 52, 11, 24, 60, 19, 56, 33, + 29, 50, 40, 54, 14, 3, 47, 20, + 18, 25, 4, 36, 26, 42, 31, 8 +}; + +//--------------------------- +// Main transition functions +//--------------------------- -// code static void CB2_TestBattleTransition(void) { switch (sTestingTransitionState) @@ -921,7 +1017,8 @@ static void CB2_TestBattleTransition(void) UpdatePaletteFade(); } -void TestBattleTransition(u8 transitionId) +// Unused +static void TestBattleTransition(u8 transitionId) { sTestingTransitionId = transitionId; SetMainCallback2(CB2_TestBattleTransition); @@ -938,20 +1035,17 @@ void BattleTransition_Start(u8 transitionId) LaunchBattleTransitionTask(transitionId); } -// in all tasks data[0] is reserved for the state -#define tState data[0] - // main task that launches sub-tasks for phase1 and phase2 #define tTransitionId data[1] #define tTransitionDone data[15] bool8 IsBattleTransitionDone(void) { - u8 taskId = FindTaskIdByFunc(Task_BattleTransitionMain); + u8 taskId = FindTaskIdByFunc(Task_BattleTransition); if (gTasks[taskId].tTransitionDone) { DestroyTask(taskId); - FREE_AND_SET_NULL(sTransitionStructPtr); + FREE_AND_SET_NULL(sTransitionData); return TRUE; } else @@ -962,23 +1056,23 @@ bool8 IsBattleTransitionDone(void) static void LaunchBattleTransitionTask(u8 transitionId) { - u8 taskId = CreateTask(Task_BattleTransitionMain, 2); + u8 taskId = CreateTask(Task_BattleTransition, 2); gTasks[taskId].tTransitionId = transitionId; - sTransitionStructPtr = AllocZeroed(sizeof(*sTransitionStructPtr)); + sTransitionData = AllocZeroed(sizeof(*sTransitionData)); } -static void Task_BattleTransitionMain(u8 taskId) +static void Task_BattleTransition(u8 taskId) { - while (sMainTransitionPhases[gTasks[taskId].tState](&gTasks[taskId])); + while (sTaskHandlers[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Transition_Phase1(struct Task *task) +static bool8 Transition_StartIntro(struct Task *task) { SetWeatherScreenFadeOut(); - CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); - if (sPhase1_Tasks[task->tTransitionId] != NULL) + CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, sizeof(gPlttBufferUnfaded)); + if (sTasks_Intro[task->tTransitionId] != NULL) { - CreateTask(sPhase1_Tasks[task->tTransitionId], 4); + CreateTask(sTasks_Intro[task->tTransitionId], 4); task->tState++; return FALSE; } @@ -989,9 +1083,9 @@ static bool8 Transition_Phase1(struct Task *task) } } -static bool8 Transition_WaitForPhase1(struct Task *task) +static bool8 Transition_WaitForIntro(struct Task *task) { - if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == TASK_NONE) + if (FindTaskIdByFunc(sTasks_Intro[task->tTransitionId]) == TASK_NONE) { task->tState++; return TRUE; @@ -1002,17 +1096,17 @@ static bool8 Transition_WaitForPhase1(struct Task *task) } } -static bool8 Transition_Phase2(struct Task *task) +static bool8 Transition_StartMain(struct Task *task) { - CreateTask(sPhase2_Tasks[task->tTransitionId], 0); + CreateTask(sTasks_Main[task->tTransitionId], 0); task->tState++; return FALSE; } -static bool8 Transition_WaitForPhase2(struct Task *task) +static bool8 Transition_WaitForMain(struct Task *task) { task->tTransitionDone = FALSE; - if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == TASK_NONE) + if (FindTaskIdByFunc(sTasks_Main[task->tTransitionId]) == TASK_NONE) task->tTransitionDone = TRUE; return FALSE; } @@ -1020,38 +1114,32 @@ static bool8 Transition_WaitForPhase2(struct Task *task) #undef tTransitionId #undef tTransitionDone -static void Phase1Task_TransitionAll(u8 taskId) +static void Task_Intro(u8 taskId) { if (gTasks[taskId].tState == 0) { gTasks[taskId].tState++; - CreatePhase1Task(0, 0, 3, 2, 2); // creates a sub-task for this sub-task + CreateIntroTask(0, 0, 3, 2, 2); } - else if (IsPhase1Done()) + else if (IsIntroTaskDone()) { DestroyTask(taskId); } } -// sub-task for phase2 -#define tData1 data[1] -#define tData2 data[2] -#define tData3 data[3] -#define tData4 data[4] -#define tData5 data[5] -#define tData6 data[6] -#define tFuncState data[7] -#define tFrames data[8] -#define tOpponentSpriteId data[13] -#define tPlayerSpriteId data[14] -#define tMugshotId data[15] +//-------------------- +// B_TRANSITION_BLUR +//-------------------- -static void Phase2Task_Blur(u8 taskId) +#define tDelay data[1] +#define tCounter data[2] + +static void Task_Blur(u8 taskId) { - while (sPhase2_Blur_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sBlur_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Blur_Func1(struct Task *task) +static bool8 Blur_Init(struct Task *task) { SetGpuReg(REG_OFFSET_MOSAIC, 0); SetGpuRegBits(REG_OFFSET_BG1CNT, BGCNT_MOSAIC); @@ -1061,48 +1149,58 @@ static bool8 Phase2_Blur_Func1(struct Task *task) return TRUE; } -static bool8 Phase2_Blur_Func2(struct Task *task) +static bool8 Blur_Main(struct Task *task) { - if (task->tData1 != 0) + if (task->tDelay != 0) { - task->tData1--; + task->tDelay--; } else { - task->tData1 = 4; - if (++task->tData2 == 10) - BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_BLACK); - SetGpuReg(REG_OFFSET_MOSAIC, (task->tData2 & 15) * 17); - if (task->tData2 > 14) + task->tDelay = 4; + if (++task->tCounter == 10) + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); + SetGpuReg(REG_OFFSET_MOSAIC, (task->tCounter & 15) * 17); + if (task->tCounter > 14) task->tState++; } return FALSE; } -static bool8 Phase2_Blur_Func3(struct Task *task) +static bool8 Blur_End(struct Task *task) { if (!gPaletteFade.active) { - u8 taskId = FindTaskIdByFunc(Phase2Task_Blur); + u8 taskId = FindTaskIdByFunc(Task_Blur); DestroyTask(taskId); } return FALSE; } -static void Phase2Task_Swirl(u8 taskId) +#undef tDelay +#undef tCounter + +//-------------------- +// B_TRANSITION_SWIRL +//-------------------- + +#define tSinIndex data[1] +#define tAmplitude data[2] + +static void Task_Swirl(u8 taskId) { - while (sPhase2_Swirl_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sSwirl_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Swirl_Func1(struct Task *task) +static bool8 Swirl_Init(struct Task *task) { - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 0x10, RGB_BLACK); - sub_8149F98(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_14, 0, 2, 0, 160); + BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK); + SetSinWave(gScanlineEffectRegBuffers[1], sTransitionData->cameraX, 0, 2, 0, DISPLAY_HEIGHT); - SetVBlankCallback(VBlankCB_Phase2_Swirl); - SetHBlankCallback(HBlankCB_Phase2_Swirl); + SetVBlankCallback(VBlankCB_Swirl); + SetHBlankCallback(HBlankCB_Swirl); EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); @@ -1110,32 +1208,32 @@ static bool8 Phase2_Swirl_Func1(struct Task *task) return FALSE; } -static bool8 Phase2_Swirl_Func2(struct Task *task) +static bool8 Swirl_End(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - task->tData1 += 4; - task->tData2 += 8; + sTransitionData->VBlank_DMA = FALSE; + task->tSinIndex += 4; + task->tAmplitude += 8; - sub_8149F98(gScanlineEffectRegBuffers[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); + SetSinWave(gScanlineEffectRegBuffers[0], sTransitionData->cameraX, task->tSinIndex, 2, task->tAmplitude, DISPLAY_HEIGHT); if (!gPaletteFade.active) { - u8 taskId = FindTaskIdByFunc(Phase2Task_Swirl); + u8 taskId = FindTaskIdByFunc(Task_Swirl); DestroyTask(taskId); } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static void VBlankCB_Phase2_Swirl(void) +static void VBlankCB_Swirl(void) { VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); } -static void HBlankCB_Phase2_Swirl(void) +static void HBlankCB_Swirl(void) { u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; @@ -1143,21 +1241,31 @@ static void HBlankCB_Phase2_Swirl(void) REG_BG3HOFS = var; } -static void Phase2Task_Shuffle(u8 taskId) +#undef tSinIndex +#undef tAmplitude + +//---------------------- +// B_TRANSITION_SHUFFLE +//---------------------- + +#define tSinVal data[1] +#define tAmplitude data[2] + +static void Task_Shuffle(u8 taskId) { - while (sPhase2_Shuffle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sShuffle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Shuffle_Func1(struct Task *task) +static bool8 Shuffle_Init(struct Task *task) { - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 0x10, RGB_BLACK); - memset(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_16, 0x140); + BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK); + memset(gScanlineEffectRegBuffers[1], sTransitionData->cameraY, DISPLAY_HEIGHT * 2); - SetVBlankCallback(VBlankCB_Phase2_Shuffle); - SetHBlankCallback(HBlankCB_Phase2_Shuffle); + SetVBlankCallback(VBlankCB_Shuffle); + SetHBlankCallback(HBlankCB_Shuffle); EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); @@ -1165,38 +1273,38 @@ static bool8 Phase2_Shuffle_Func1(struct Task *task) return FALSE; } -static bool8 Phase2_Shuffle_Func2(struct Task *task) +static bool8 Shuffle_End(struct Task *task) { u8 i; - u16 r3, r4; + u16 amplitude, sinVal; - sTransitionStructPtr->VBlank_DMA = FALSE; - r4 = task->tData1; - r3 = task->tData2 >> 8; - task->tData1 += 4224; - task->tData2 += 384; + sTransitionData->VBlank_DMA = FALSE; + sinVal = task->tSinVal; + amplitude = task->tAmplitude >> 8; + task->tSinVal += 4224; + task->tAmplitude += 384; - for (i = 0; i < 160; i++, r4 += 4224) + for (i = 0; i < DISPLAY_HEIGHT; i++, sinVal += 4224) { - u16 var = r4 / 256; - gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + u16 sinIndex = sinVal / 256; + gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(sinIndex, amplitude); } if (!gPaletteFade.active) - DestroyTask(FindTaskIdByFunc(Phase2Task_Shuffle)); + DestroyTask(FindTaskIdByFunc(Task_Shuffle)); - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static void VBlankCB_Phase2_Shuffle(void) +static void VBlankCB_Shuffle(void) { VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); } -static void HBlankCB_Phase2_Shuffle(void) +static void HBlankCB_Shuffle(void) { u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; @@ -1204,221 +1312,240 @@ static void HBlankCB_Phase2_Shuffle(void) REG_BG3VOFS = var; } -static void Phase2Task_BigPokeball(u8 taskId) +#undef tSinVal +#undef tAmplitude + +//------------------------------------------------------------------------ +// B_TRANSITION_BIG_POKEBALL, B_TRANSITION_AQUA, B_TRANSITION_MAGMA, +// B_TRANSITION_REGICE, B_TRANSITION_REGISTEEL, B_TRANSITION_REGIROCK +// and B_TRANSITION_KYOGRE. +// +// With the exception of B_TRANSITION_KYOGRE, all of the above transitions +// use the same weave effect (see the PatternWeave functions). +// Unclear why Kyogre's was grouped here and not with Groudon/Rayquaza's. +//------------------------------------------------------------------------ + +#define tBlendTarget1 data[1] +#define tBlendTarget2 data[2] +#define tBlendDelay data[3] + +// Data 1-3 change purpose for PatternWeave_CircularMask +#define tRadius data[1] +#define tRadiusDelta data[2] +#define tVBlankSet data[3] + +#define tSinIndex data[4] +#define tAmplitude data[5] +#define tEndDelay data[8] + +static void Task_BigPokeball(u8 taskId) { - while (sPhase2_BigPokeball_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sBigPokeball_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Aqua(u8 taskId) +static void Task_Aqua(u8 taskId) { - while (sPhase2_Aqua_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sAqua_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Magma(u8 taskId) +static void Task_Magma(u8 taskId) { - while (sPhase2_Magma_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sMagma_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Regice(u8 taskId) +static void Task_Regice(u8 taskId) { - while (sPhase2_Regice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRegice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Registeel(u8 taskId) +static void Task_Registeel(u8 taskId) { - while (sPhase2_Registeel_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRegisteel_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Regirock(u8 taskId) +static void Task_Regirock(u8 taskId) { - while (sPhase2_Regirock_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRegirock_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Kyogre(u8 taskId) +static void Task_Kyogre(u8 taskId) { - while (sPhase2_Kyogre_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sKyogre_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void sub_814669C(struct Task *task) +static void InitPatternWeaveTransition(struct Task *task) { s32 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - task->tData1 = 16; - task->tData2 = 0; - task->tData4 = 0; - task->tData5 = 0x4000; - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; - sTransitionStructPtr->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL; - sTransitionStructPtr->BLDALPHA = BLDALPHA_BLEND(task->tData2, task->tData1); - - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = 240; - } + task->tBlendTarget1 = 16; + task->tBlendTarget2 = 0; + task->tSinIndex = 0; + task->tAmplitude = 0x4000; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = 0; + sTransitionData->WIN0H = DISPLAY_WIDTH; + sTransitionData->WIN0V = DISPLAY_HEIGHT; + sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL; + sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); + + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH; - SetVBlankCallback(VBlankCB0_Phase2_BigPokeball); + SetVBlankCallback(VBlankCB_PatternWeave); } -static bool8 Phase2_Aqua_Func1(struct Task *task) +static bool8 Aqua_Init(struct Task *task) { u16 *tilemap, *tileset; - task->tFrames = 60; - sub_814669C(task); + task->tEndDelay = 60; + InitPatternWeaveTransition(task); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sTeamAqua_Tileset, tileset); - LoadPalette(sEvilTeam_Palette, 0xF0, 0x20); + LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette)); task->tState++; return FALSE; } -static bool8 Phase2_Magma_Func1(struct Task *task) +static bool8 Magma_Init(struct Task *task) { u16 *tilemap, *tileset; - task->tFrames = 60; - sub_814669C(task); + task->tEndDelay = 60; + InitPatternWeaveTransition(task); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sTeamMagma_Tileset, tileset); - LoadPalette(sEvilTeam_Palette, 0xF0, 0x20); + LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette)); task->tState++; return FALSE; } -static bool8 Phase2_Regi_Func1(struct Task *task) +static bool8 Regi_Init(struct Task *task) { u16 *tilemap, *tileset; - task->tFrames = 60; - sub_814669C(task); + task->tEndDelay = 60; + InitPatternWeaveTransition(task); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); CpuCopy16(sRegis_Tileset, tileset, 0x2000); task->tState++; return FALSE; } -static bool8 Phase2_BigPokeball_Func1(struct Task *task) +static bool8 BigPokeball_Init(struct Task *task) { u16 *tilemap, *tileset; - sub_814669C(task); + InitPatternWeaveTransition(task); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); - CpuCopy16(sBigPokeball_Tileset, tileset, 0x580); - LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); + CpuCopy16(sBigPokeball_Tileset, tileset, sizeof(sBigPokeball_Tileset)); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball)); task->tState++; return FALSE; } -#define SOME_VRAM_STORE(ptr, posY, posX, toStore) \ -{ \ - u32 index = (posY) * 32 + posX; \ - ptr[index] = toStore; \ -} - -static bool8 Phase2_BigPokeball_Func2(struct Task *task) +static bool8 BigPokeball_SetGfx(struct Task *task) { s16 i, j; u16 *tilemap, *tileset; - const u16 *BigPokeballMap; + const u16 *bigPokeballMap; GetBg0TilesDst(&tilemap, &tileset); - BigPokeballMap = sBigPokeball_Tilemap; + bigPokeballMap = sBigPokeball_Tilemap; for (i = 0; i < 20; i++) { - for (j = 0; j < 30; j++, BigPokeballMap++) - { - SOME_VRAM_STORE(tilemap, i, j, *BigPokeballMap | 0xF000); - } + for (j = 0; j < 30; j++, bigPokeballMap++) + SET_TILE(tilemap, i, j, *bigPokeballMap); } - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return TRUE; } -static bool8 Phase2_Aqua_Func2(struct Task *task) +static bool8 Aqua_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sTeamAqua_Tilemap, tilemap); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return FALSE; } -static bool8 Phase2_Magma_Func2(struct Task *task) +static bool8 Magma_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sTeamMagma_Tilemap, tilemap); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return FALSE; } -static bool8 Phase2_Regice_Func2(struct Task *task) +static bool8 Regice_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - LoadPalette(sRegice_Palette, 0xF0, 0x20); + LoadPalette(sRegice_Palette, 0xF0, sizeof(sRegice_Palette)); CpuCopy16(sRegice_Tilemap, tilemap, 0x500); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return FALSE; } -static bool8 Phase2_Registeel_Func2(struct Task *task) +static bool8 Registeel_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - LoadPalette(sRegisteel_Palette, 0xF0, 0x20); + LoadPalette(sRegisteel_Palette, 0xF0, sizeof(sRegisteel_Palette)); CpuCopy16(sRegisteel_Tilemap, tilemap, 0x500); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return FALSE; } -static bool8 Phase2_Regirock_Func2(struct Task *task) +static bool8 Regirock_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - LoadPalette(sRegirock_Palette, 0xF0, 0x20); + LoadPalette(sRegirock_Palette, 0xF0, sizeof(sRegirock_Palette)); CpuCopy16(sRegirock_Tilemap, tilemap, 0x500); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return FALSE; } -static bool8 Phase2_Kyogre_Func3(struct Task *task) +#define tTimer data[1] + +static bool8 Kyogre_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sKyogre_Tileset, tileset); LZ77UnCompVram(sKyogre_Tilemap, tilemap); @@ -1426,48 +1553,48 @@ static bool8 Phase2_Kyogre_Func3(struct Task *task) return FALSE; } -static bool8 Phase2_Kyogre_Func4(struct Task *task) +static bool8 Kyogre_PaletteFlash(struct Task *task) { - if (task->tData1 % 3 == 0) + if (task->tTimer % 3 == 0) { - u16 var = task->tData1 % 30; - var /= 3; - LoadPalette(sKyogre1_Palette + (var * 16), 0xF0, 0x20); + u16 offset = task->tTimer % 30; + offset /= 3; + LoadPalette(&sKyogre1_Palette[offset * 16], 0xF0, 0x20); } - if (++task->tData1 > 58) + if (++task->tTimer > 58) { task->tState++; - task->tData1 = 0; + task->tTimer = 0; } return FALSE; } -static bool8 Phase2_Kyogre_Func5(struct Task *task) +static bool8 Kyogre_PaletteBrighten(struct Task *task) { - if (task->tData1 % 5 == 0) + if (task->tTimer % 5 == 0) { - s16 var = task->tData1 / 5; - LoadPalette(sKyogre2_Palette + (var * 16), 0xF0, 0x20); + s16 offset = task->tTimer / 5; + LoadPalette(&sKyogre2_Palette[offset * 16], 0xF0, 0x20); } - if (++task->tData1 > 68) + if (++task->tTimer > 68) { task->tState++; - task->tData1 = 0; - task->tFrames = 30; + task->tTimer = 0; + task->tEndDelay = 30; } return FALSE; } -static bool8 Phase2_WeatherDuo_Func6(struct Task *task) +static bool8 WeatherDuo_FadeOut(struct Task *task) { - BeginNormalPaletteFade(PALETTES_OBJECTS | 0x8000, 1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_OBJECTS | (1 << 15), 1, 0, 16, RGB_BLACK); task->tState++; return FALSE; } -static bool8 Phase2_WeatherDuo_Func7(struct Task *task) +static bool8 WeatherDuo_End(struct Task *task) { if (!gPaletteFade.active) { @@ -1478,100 +1605,106 @@ static bool8 Phase2_WeatherDuo_Func7(struct Task *task) return FALSE; } -static bool8 Phase2_BigPokeball_Func3(struct Task *task) +#undef tTimer + +// The PatternWeave_ functions are used by several different transitions. +// They create an effect where a pattern/image (such as the Magma emblem) is +// formed by a shimmering weave effect. +static bool8 PatternWeave_Blend1(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tData3 == 0 || --task->tData3 == 0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tBlendDelay == 0 || --task->tBlendDelay == 0) { - task->tData2++; - task->tData3 = 2; + task->tBlendTarget2++; + task->tBlendDelay = 2; } - sTransitionStructPtr->BLDALPHA = BLDALPHA_BLEND(task->tData2, task->tData1); - if (task->tData2 > 15) + sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); + if (task->tBlendTarget2 > 15) task->tState++; - task->tData4 += 8; - task->tData5 -= 256; + task->tSinIndex += 8; + task->tAmplitude -= 256; - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT); - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_BigPokeball_Func4(struct Task *task) +static bool8 PatternWeave_Blend2(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tData3 == 0 || --task->tData3 == 0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tBlendDelay == 0 || --task->tBlendDelay == 0) { - task->tData1--; - task->tData3 = 2; + task->tBlendTarget1--; + task->tBlendDelay = 2; } - sTransitionStructPtr->BLDALPHA = BLDALPHA_BLEND(task->tData2, task->tData1); - if (task->tData1 == 0) + sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); + if (task->tBlendTarget1 == 0) task->tState++; - task->tData4 += 8; - task->tData5 -= 256; + task->tSinIndex += 8; + task->tAmplitude -= 256; - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT); - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_BigPokeball_Func5(struct Task *task) +static bool8 PatternWeave_FinishAppear(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - task->tData4 += 8; - task->tData5 -= 256; + sTransitionData->VBlank_DMA = FALSE; + task->tSinIndex += 8; + task->tAmplitude -= 256; - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT); - if (task->tData5 <= 0) + if (task->tAmplitude <= 0) { task->tState++; - task->tData1 = 160; - task->tData2 = 256; - task->tData3 = 0; + task->tRadius = DISPLAY_HEIGHT; + task->tRadiusDelta = 1 << 8; + task->tVBlankSet = FALSE; } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_FramesCountdown(struct Task *task) +static bool8 FramesCountdown(struct Task *task) { - if (--task->tFrames == 0) + if (--task->tEndDelay == 0) task->tState++; return FALSE; } -static bool8 Phase2_WeatherTrio_Func1(struct Task *task) +static bool8 WeatherTrio_BgFadeBlack(struct Task *task) { - BeginNormalPaletteFade(PALETTES_BG, 1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_BG, 1, 0, 16, RGB_BLACK); task->tState++; return FALSE; } -static bool8 Phase2_WaitPaletteFade(struct Task *task) +static bool8 WeatherTrio_WaitFade(struct Task *task) { if (!gPaletteFade.active) task->tState++; return FALSE; } -static bool8 Phase2_BigPokeball_Func6(struct Task *task) +// Do a shrinking circular mask to go to a black screen after the pattern appears. +static bool8 PatternWeave_CircularMask(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tData2 < 1024) - task->tData2 += 128; - if (task->tData1 != 0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tRadiusDelta < (4 << 8)) + task->tRadiusDelta += 128; // 256 is 1 unit of speed. Speed up every other frame (128 / 256) + if (task->tRadius != 0) { - task->tData1 -= (task->tData2 >> 8); - if (task->tData1 < 0) - task->tData1 = 0; + task->tRadius -= task->tRadiusDelta >> 8; + if (task->tRadius < 0) + task->tRadius = 0; } - sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->tData1); - if (task->tData1 == 0) + SetCircularMask(gScanlineEffectRegBuffers[0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, task->tRadius); + if (task->tRadius == 0) { SetVBlankCallback(NULL); DmaStop(0); @@ -1580,357 +1713,382 @@ static bool8 Phase2_BigPokeball_Func6(struct Task *task) } else { - if (task->tData3 == 0) + if (!task->tVBlankSet) { - task->tData3++; - SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + task->tVBlankSet++; + SetVBlankCallback(VBlankCB_CircularMask); } - - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; } - return FALSE; } -static void Transition_BigPokeball_Vblank(void) +static void VBlankCB_SetWinAndBlend(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; + REG_BLDCNT = sTransitionData->BLDCNT; + REG_BLDALPHA = sTransitionData->BLDALPHA; } -static void VBlankCB0_Phase2_BigPokeball(void) +static void VBlankCB_PatternWeave(void) { - Transition_BigPokeball_Vblank(); - DmaSet(0, gScanlineEffectRegBuffers[1], ®_BG0HOFS, 0xA2400001); + VBlankCB_SetWinAndBlend(); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BG0HOFS, B_TRANS_DMA_FLAGS); } -static void VBlankCB1_Phase2_BigPokeball(void) +static void VBlankCB_CircularMask(void) { - Transition_BigPokeball_Vblank(); - DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); + VBlankCB_SetWinAndBlend(); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS); } -static void Phase2Task_PokeballsTrail(u8 taskId) +#undef tAmplitude +#undef tSinIndex +#undef tBlendTarget1 +#undef tBlendTarget2 +#undef tRadius +#undef tRadiusDelta +#undef tVBlankSet + +//------------------------------ +// B_TRANSITION_POKEBALLS_TRAIL +//------------------------------ + +#define sSide data[0] +#define sDelay data[1] +#define sPrevX data[2] + +static void Task_PokeballsTrail(u8 taskId) { - while (sPhase2_PokeballsTrail_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sPokeballsTrail_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_PokeballsTrail_Func1(struct Task *task) +static bool8 PokeballsTrail_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); CpuSet(sPokeballTrail_Tileset, tileset, 0x20); - CpuFill32(0, tilemap, 0x800); - LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); + CpuFill32(0, tilemap, BG_SCREEN_SIZE); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball)); task->tState++; return FALSE; } -static bool8 Phase2_PokeballsTrail_Func2(struct Task *task) +static bool8 PokeballsTrail_Main(struct Task *task) { s16 i; - s16 rand; - s16 arr0[ARRAY_COUNT(sUnknown_085C8B88)]; - s16 arr1[ARRAY_COUNT(sUnknown_085C8B8C)]; - - memcpy(arr0, sUnknown_085C8B88, sizeof(sUnknown_085C8B88)); - memcpy(arr1, sUnknown_085C8B8C, sizeof(sUnknown_085C8B8C)); - rand = Random() & 1; - for (i = 0; i <= 4; i++, rand ^= 1) + s16 side; + s16 startX[ARRAY_COUNT(sPokeballsTrail_StartXCoords)]; + s16 delays[ARRAY_COUNT(sPokeballsTrail_Delays)]; + memcpy(startX, sPokeballsTrail_StartXCoords, sizeof(sPokeballsTrail_StartXCoords)); + memcpy(delays, sPokeballsTrail_Delays, sizeof(sPokeballsTrail_Delays)); + + // Randomly pick which side the first ball should start on. + // The side is then flipped for each subsequent ball. + side = Random() & 1; + for (i = 0; i < NUM_POKEBALL_TRAILS; i++, side ^= 1) { - gFieldEffectArguments[0] = arr0[rand]; // x - gFieldEffectArguments[1] = (i * 32) + 16; // y - gFieldEffectArguments[2] = rand; - gFieldEffectArguments[3] = arr1[i]; - FieldEffectStart(FLDEFF_POKEBALL); + gFieldEffectArguments[0] = startX[side]; // x + gFieldEffectArguments[1] = (i * 32) + 16; // y + gFieldEffectArguments[2] = side; + gFieldEffectArguments[3] = delays[i]; + FieldEffectStart(FLDEFF_POKEBALL_TRAIL); } task->tState++; return FALSE; } -static bool8 Phase2_PokeballsTrail_Func3(struct Task *task) +static bool8 PokeballsTrail_End(struct Task *task) { - if (!FieldEffectActiveListContains(FLDEFF_POKEBALL)) + if (!FieldEffectActiveListContains(FLDEFF_POKEBALL_TRAIL)) { FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_PokeballsTrail)); + DestroyTask(FindTaskIdByFunc(Task_PokeballsTrail)); } return FALSE; } -bool8 FldEff_Pokeball(void) +bool8 FldEff_PokeballTrail(void) { u8 spriteId = CreateSpriteAtEnd(&sSpriteTemplate_Pokeball, gFieldEffectArguments[0], gFieldEffectArguments[1], 0); gSprites[spriteId].oam.priority = 0; gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteId].data[0] = gFieldEffectArguments[2]; - gSprites[spriteId].data[1] = gFieldEffectArguments[3]; - gSprites[spriteId].data[2] = -1; + gSprites[spriteId].sSide = gFieldEffectArguments[2]; + gSprites[spriteId].sDelay = gFieldEffectArguments[3]; + gSprites[spriteId].sPrevX = -1; InitSpriteAffineAnim(&gSprites[spriteId]); StartSpriteAffineAnim(&gSprites[spriteId], gFieldEffectArguments[2]); return FALSE; } -static void sub_814713C(struct Sprite *sprite) +static void SpriteCB_FldEffPokeballTrail(struct Sprite *sprite) { - s16 arr0[ARRAY_COUNT(sUnknown_085C8B96)]; + s16 speeds[ARRAY_COUNT(sPokeballsTrail_Speeds)]; + memcpy(speeds, sPokeballsTrail_Speeds, sizeof(sPokeballsTrail_Speeds)); - memcpy(arr0, sUnknown_085C8B96, sizeof(sUnknown_085C8B96)); - if (sprite->data[1] != 0) + if (sprite->sDelay != 0) { - sprite->data[1]--; + sprite->sDelay--; } else { if (sprite->x >= 0 && sprite->x <= DISPLAY_WIDTH) { + // Set Pokéball position s16 posX = sprite->x >> 3; s16 posY = sprite->y >> 3; - if (posX != sprite->data[2]) + // If Pokéball moved forward clear trail behind it + if (posX != sprite->sPrevX) { u32 var; u16 *ptr; - sprite->data[2] = posX; - var = (((REG_BG0CNT >> 8) & 0x1F) << 11); - ptr = (u16 *)(VRAM + var); + sprite->sPrevX = posX; + var = ((REG_BG0CNT >> 8) & 0x1F) << 11; + ptr = (u16 *)(BG_VRAM + var); - SOME_VRAM_STORE(ptr, posY - 2, posX, 0xF001); - SOME_VRAM_STORE(ptr, posY - 1, posX, 0xF001); - SOME_VRAM_STORE(ptr, posY - 0, posX, 0xF001); - SOME_VRAM_STORE(ptr, posY + 1, posX, 0xF001); + SET_TILE(ptr, posY - 2, posX, 1); + SET_TILE(ptr, posY - 1, posX, 1); + SET_TILE(ptr, posY - 0, posX, 1); + SET_TILE(ptr, posY + 1, posX, 1); } } - sprite->x += arr0[sprite->data[0]]; - if (sprite->x < -15 || sprite->x > 255) - FieldEffectStop(sprite, FLDEFF_POKEBALL); + sprite->x += speeds[sprite->sSide]; + if (sprite->x < -15 || sprite->x > DISPLAY_WIDTH + 15) + FieldEffectStop(sprite, FLDEFF_POKEBALL_TRAIL); } } -static void Phase2Task_Clockwise_BlackFade(u8 taskId) +#undef sSide +#undef sDelay +#undef sPrevX + +//----------------------------- +// B_TRANSITION_CLOCKWISE_WIPE +//----------------------------- + +static void Task_ClockwiseWipe(u8 taskId) { - while (sPhase2_Clockwise_BlackFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sClockwiseWipe_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) +static bool8 ClockwiseWipe_Init(struct Task *task) { u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->WININ = 0; - sTransitionStructPtr->WINOUT = WINOUT_WIN01_ALL; - sTransitionStructPtr->WIN0H = -3855; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = 0; + sTransitionData->WINOUT = WINOUT_WIN01_ALL; + sTransitionData->WIN0H = WIN_RANGE(DISPLAY_WIDTH, DISPLAY_WIDTH + 1); + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = 0xF3F4; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = ((DISPLAY_WIDTH + 3) << 8) | (DISPLAY_WIDTH + 4); - SetVBlankCallback(VBlankCB_Phase2_Clockwise_BlackFade); - sTransitionStructPtr->data[4] = 120; + SetVBlankCallback(VBlankCB_ClockwiseWipe); + sTransitionData->tWipeEndX = DISPLAY_WIDTH / 2; task->tState++; return TRUE; } -static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) +static bool8 ClockwiseWipe_TopRight(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], -1, 1, 1); + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, -1, 1, 1); do { - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; - } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = (sTransitionData->tWipeCurrX + 1) | ((DISPLAY_WIDTH / 2) << 8); + } while (!UpdateBlackWipe(sTransitionData->data, TRUE, TRUE)); - sTransitionStructPtr->data[4] += 16; - if (sTransitionStructPtr->data[4] >= 240) + sTransitionData->tWipeEndX += 16; + if (sTransitionData->tWipeEndX >= DISPLAY_WIDTH) { - sTransitionStructPtr->data[5] = 0; + sTransitionData->tWipeEndY = 0; task->tState++; } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) +static bool8 ClockwiseWipe_Right(struct Task *task) { - s16 r1, r3; - vu8 var = 0; + s16 start, end; + vu8 finished = FALSE; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - sub_814A1AC(sTransitionStructPtr->data, 120, 80, 240, sTransitionStructPtr->data[5], 1, 1); + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_WIDTH, sTransitionData->tWipeEndY, 1, 1); while (1) { - r1 = 120, r3 = sTransitionStructPtr->data[2] + 1; - if (sTransitionStructPtr->data[5] >= 80) - r1 = sTransitionStructPtr->data[2], r3 = 240; - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); - if (var != 0) + start = DISPLAY_WIDTH / 2, end = sTransitionData->tWipeCurrX + 1; + if (sTransitionData->tWipeEndY >= DISPLAY_HEIGHT / 2) + start = sTransitionData->tWipeCurrX, end = DISPLAY_WIDTH; + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = end | (start << 8); + if (finished) break; - var = sub_814A228(sTransitionStructPtr->data, 1, 1); + finished = UpdateBlackWipe(sTransitionData->data, TRUE, TRUE); } - sTransitionStructPtr->data[5] += 8; - if (sTransitionStructPtr->data[5] >= 160) + sTransitionData->tWipeEndY += 8; + if (sTransitionData->tWipeEndY >= DISPLAY_HEIGHT) { - sTransitionStructPtr->data[4] = 240; + sTransitionData->tWipeEndX = DISPLAY_WIDTH; task->tState++; } else { - while (sTransitionStructPtr->data[3] < sTransitionStructPtr->data[5]) - { - gScanlineEffectRegBuffers[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); - } + while (sTransitionData->tWipeCurrY < sTransitionData->tWipeEndY) + gScanlineEffectRegBuffers[0][++sTransitionData->tWipeCurrY] = end | (start << 8); } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) +static bool8 ClockwiseWipe_Bottom(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 160, 1, 1); + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, DISPLAY_HEIGHT, 1, 1); do { - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; - } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = (sTransitionData->tWipeCurrX << 8) | DISPLAY_WIDTH; + } while (!UpdateBlackWipe(sTransitionData->data, TRUE, TRUE)); - sTransitionStructPtr->data[4] -= 16; - if (sTransitionStructPtr->data[4] <= 0) + sTransitionData->tWipeEndX -= 16; + if (sTransitionData->tWipeEndX <= 0) { - sTransitionStructPtr->data[5] = 160; + sTransitionData->tWipeEndY = DISPLAY_HEIGHT; task->tState++; } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) +static bool8 ClockwiseWipe_Left(struct Task *task) { - s16 r1, r2, var4; - vu8 var = 0; + s16 end, start, temp; + vu8 finished = FALSE; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - sub_814A1AC(sTransitionStructPtr->data, 120, 80, 0, sTransitionStructPtr->data[5], 1, 1); + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0, sTransitionData->tWipeEndY, 1, 1); while (1) { - r1 = (gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]]) & 0xFF; - r2 = sTransitionStructPtr->data[2]; - if (sTransitionStructPtr->data[5] <= 80) - r2 = 120, r1 = sTransitionStructPtr->data[2]; - var4 = (r1) | (r2 << 8); - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = var4; - if (var != 0) + end = (gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY]) & 0xFF; + start = sTransitionData->tWipeCurrX; + if (sTransitionData->tWipeEndY <= DISPLAY_HEIGHT / 2) + start = DISPLAY_WIDTH / 2, end = sTransitionData->tWipeCurrX; + temp = end | (start << 8); + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = temp; + if (finished) break; - var = sub_814A228(sTransitionStructPtr->data, 1, 1); + finished = UpdateBlackWipe(sTransitionData->data, TRUE, TRUE); } - sTransitionStructPtr->data[5] -= 8; - if (sTransitionStructPtr->data[5] <= 0) + sTransitionData->tWipeEndY -= 8; + if (sTransitionData->tWipeEndY <= 0) { - sTransitionStructPtr->data[4] = 0; + sTransitionData->tWipeEndX = 0; task->tState++; } else { - while (sTransitionStructPtr->data[3] > sTransitionStructPtr->data[5]) - { - gScanlineEffectRegBuffers[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); - } + while (sTransitionData->tWipeCurrY > sTransitionData->tWipeEndY) + gScanlineEffectRegBuffers[0][--sTransitionData->tWipeCurrY] = end | (start << 8); } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) +static bool8 ClockwiseWipe_TopLeft(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 0, 1, 1); + InitBlackWipe(sTransitionData->data, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sTransitionData->tWipeEndX, 0, 1, 1); do { - s16 r2, r3; - - r2 = 120, r3 = sTransitionStructPtr->data[2]; - if (sTransitionStructPtr->data[2] >= 120) - r2 = 0, r3 = 240; - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); - - } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); - - sTransitionStructPtr->data[4] += 16; - if (sTransitionStructPtr->data[2] > 120) + s16 start, end; + start = DISPLAY_WIDTH / 2, end = sTransitionData->tWipeCurrX; + if (sTransitionData->tWipeCurrX >= DISPLAY_WIDTH / 2) + start = 0, end = DISPLAY_WIDTH; + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = end | (start << 8); + } while (!UpdateBlackWipe(sTransitionData->data, TRUE, TRUE)); + + sTransitionData->tWipeEndX += 16; + if (sTransitionData->tWipeCurrX > DISPLAY_WIDTH / 2) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task) +static bool8 ClockwiseWipe_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_Clockwise_BlackFade)); + DestroyTask(FindTaskIdByFunc(Task_ClockwiseWipe)); return FALSE; } -static void VBlankCB_Phase2_Clockwise_BlackFade(void) +static void VBlankCB_ClockwiseWipe(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; + if (sTransitionData->VBlank_DMA != 0) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; REG_WIN0H = gScanlineEffectRegBuffers[1][0]; - DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS); } -static void Phase2Task_Ripple(u8 taskId) +//--------------------- +// B_TRANSITION_RIPPLE +//--------------------- + +#define tSinVal data[1] +#define tAmplitudeVal data[2] +#define tTimer data[3] +#define tFadeStarted data[4] + +static void Task_Ripple(u8 taskId) { - while (sPhase2_Ripple_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRipple_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Ripple_Func1(struct Task *task) +static bool8 Ripple_Init(struct Task *task) { u8 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraY; - SetVBlankCallback(VBlankCB_Phase2_Ripple); - SetHBlankCallback(HBlankCB_Phase2_Ripple); + SetVBlankCallback(VBlankCB_Ripple); + SetHBlankCallback(HBlankCB_Ripple); EnableInterrupts(INTR_FLAG_HBLANK); @@ -1938,48 +2096,48 @@ static bool8 Phase2_Ripple_Func1(struct Task *task) return TRUE; } -static bool8 Phase2_Ripple_Func2(struct Task *task) +static bool8 Ripple_Main(struct Task *task) { u8 i; - s16 r3; - u16 r4, r8; + s16 amplitude; + u16 sinVal, speed; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - r3 = task->tData2 >> 8; - r4 = task->tData1; - r8 = 384; - task->tData1 += 0x400; - if (task->tData2 <= 0x1FFF) - task->tData2 += 0x180; + amplitude = task->tAmplitudeVal >> 8; + sinVal = task->tSinVal; + speed = 0x180; + task->tSinVal += 0x400; + if (task->tAmplitudeVal <= 0x1FFF) + task->tAmplitudeVal += 0x180; - for (i = 0; i < 160; i++, r4 += r8) + for (i = 0; i < DISPLAY_HEIGHT; i++, sinVal += speed) { - s16 var = r4 >> 8; - gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var & 0xffff, r3); + s16 sinIndex = sinVal >> 8; + gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(sinIndex & 0xffff, amplitude); } - if (++task->tData3 == 81) + if (++task->tTimer == 81) { - task->tData4++; - BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 0x10, RGB_BLACK); + task->tFadeStarted++; + BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 16, RGB_BLACK); } - if (task->tData4 != 0 && !gPaletteFade.active) - DestroyTask(FindTaskIdByFunc(Phase2Task_Ripple)); + if (task->tFadeStarted && !gPaletteFade.active) + DestroyTask(FindTaskIdByFunc(Task_Ripple)); - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static void VBlankCB_Phase2_Ripple(void) +static void VBlankCB_Ripple(void) { VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); } -static void HBlankCB_Phase2_Ripple(void) +static void HBlankCB_Ripple(void) { u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; @@ -1987,146 +2145,181 @@ static void HBlankCB_Phase2_Ripple(void) REG_BG3VOFS = var; } -static void Phase2Task_Wave(u8 taskId) +#undef tSinVal +#undef tAmplitudeVal +#undef tTimer +#undef tFadeStarted + +//------------------- +// B_TRANSITION_WAVE +//------------------- + +#define tX data[1] +#define tSinIndex data[2] + +static void Task_Wave(u8 taskId) { - while (sPhase2_Wave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sWave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Wave_Func1(struct Task *task) +static bool8 Wave_Init(struct Task *task) { u8 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = 0; + sTransitionData->WIN0H = DISPLAY_WIDTH; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = 242; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH + 2; - SetVBlankCallback(VBlankCB_Phase2_Wave); + SetVBlankCallback(VBlankCB_Wave); task->tState++; return TRUE; } -static bool8 Phase2_Wave_Func2(struct Task *task) +static bool8 Wave_Main(struct Task *task) { - u8 i, r5; + u8 i, sinIndex; u16* toStore; - bool8 nextFunc; + bool8 finished; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; toStore = gScanlineEffectRegBuffers[0]; - r5 = task->tData2; - task->tData2 += 16; - task->tData1 += 8; + sinIndex = task->tSinIndex; + task->tSinIndex += 16; + task->tX += 8; - for (i = 0, nextFunc = TRUE; i < 160; i++, r5 += 4, toStore++) + for (i = 0, finished = TRUE; i < DISPLAY_HEIGHT; i++, sinIndex += 4, toStore++) { - s16 value = task->tData1 + Sin(r5, 40); - if (value < 0) - value = 0; - if (value > 240) - value = 240; - *toStore = (value << 8) | (0xF1); - if (value < 240) - nextFunc = FALSE; + s16 x = task->tX + Sin(sinIndex, 40); + if (x < 0) + x = 0; + if (x > DISPLAY_WIDTH) + x = DISPLAY_WIDTH; + *toStore = (x << 8) | (DISPLAY_WIDTH + 1); + if (x < DISPLAY_WIDTH) + finished = FALSE; } - if (nextFunc) + if (finished) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Wave_Func3(struct Task *task) +static bool8 Wave_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_Wave)); + DestroyTask(FindTaskIdByFunc(Task_Wave)); return FALSE; } -static void VBlankCB_Phase2_Wave(void) +static void VBlankCB_Wave(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); -} + if (sTransitionData->VBlank_DMA != 0) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS); +} + +#undef tX +#undef tSinIndex + +//---------------------------------------------------------------- +// B_TRANSITION_SIDNEY, B_TRANSITION_PHOEBE, B_TRANSITION_GLACIA, +// B_TRANSITION_DRAKE, and B_TRANSITION_CHAMPION +// +// These are all the "mugshot" transitions, where a banner shows +// the trainer pic of the player and their opponent. +//---------------------------------------------------------------- + +#define tSinIndex data[1] +#define tTopBannerX data[2] +#define tBottomBannerX data[3] +#define tTimer data[3] // Re-used +#define tFadeSpread data[4] +#define tOpponentSpriteId data[13] +#define tPlayerSpriteId data[14] +#define tMugshotId data[15] -static void Phase2Task_Sidney(u8 taskId) +// Sprite data for trainer sprites in mugshots +#define sState data[0] +#define sSlideSpeed data[1] +#define sSlideAccel data[2] +#define sDone data[6] +#define sSlideDir data[7] + +static void Task_Sidney(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_SIDNEY; - Phase2Task_MugShotTransition(taskId); + DoMugshotTransition(taskId); } -static void Phase2Task_Phoebe(u8 taskId) +static void Task_Phoebe(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_PHOEBE; - Phase2Task_MugShotTransition(taskId); + DoMugshotTransition(taskId); } -static void Phase2Task_Glacia(u8 taskId) +static void Task_Glacia(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_GLACIA; - Phase2Task_MugShotTransition(taskId); + DoMugshotTransition(taskId); } -static void Phase2Task_Drake(u8 taskId) +static void Task_Drake(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_DRAKE; - Phase2Task_MugShotTransition(taskId); + DoMugshotTransition(taskId); } -static void Phase2Task_Champion(u8 taskId) +static void Task_Champion(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_CHAMPION; - Phase2Task_MugShotTransition(taskId); + DoMugshotTransition(taskId); } -static void Phase2Task_MugShotTransition(u8 taskId) +static void DoMugshotTransition(u8 taskId) { - while (sPhase2_Mugshot_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sMugshot_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Mugshot_Func1(struct Task *task) +static bool8 Mugshot_Init(struct Task *task) { u8 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - Mugshots_CreateOpponentPlayerSprites(task); + Mugshots_CreateTrainerPics(task); - task->tData1 = 0; - task->tData2 = 1; - task->tData3 = 239; - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + task->tSinIndex = 0; + task->tTopBannerX = 1; + task->tBottomBannerX = DISPLAY_WIDTH - 1; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = 0xF0F1; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = (DISPLAY_WIDTH << 8) | (DISPLAY_WIDTH + 1); - SetVBlankCallback(VBlankCB0_Phase2_Mugshots); + SetVBlankCallback(VBlankCB_Mugshots); task->tState++; return FALSE; } -static bool8 Phase2_Mugshot_Func2(struct Task *task) +static bool8 Mugshot_SetGfx(struct Task *task) { s16 i, j; u16 *tilemap, *tileset; @@ -2141,99 +2334,108 @@ static bool8 Phase2_Mugshot_Func2(struct Task *task) for (i = 0; i < 20; i++) { for (j = 0; j < 32; j++, mugshotsMap++) - { - SOME_VRAM_STORE(tilemap, i, j, *mugshotsMap | 0xF000); - } + SET_TILE(tilemap, i, j, *mugshotsMap); } EnableInterrupts(INTR_FLAG_HBLANK); - SetHBlankCallback(HBlankCB_Phase2_Mugshots); + SetHBlankCallback(HBlankCB_Mugshots); task->tState++; return FALSE; } -static bool8 Phase2_Mugshot_Func3(struct Task *task) +static bool8 Mugshot_ShowBanner(struct Task *task) { - u8 i, r5; + u8 i, sinIndex; u16* toStore; - s16 value; + s16 x; s32 mergedValue; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; toStore = gScanlineEffectRegBuffers[0]; - r5 = task->tData1; - task->tData1 += 0x10; + sinIndex = task->tSinIndex; + task->tSinIndex += 16; - for (i = 0; i < 80; i++, toStore++, r5 += 0x10) + // Update top banner + for (i = 0; i < DISPLAY_HEIGHT / 2; i++, toStore++, sinIndex += 16) { - value = task->tData2 + Sin(r5, 0x10); - if (value < 0) - value = 1; - if (value > 0xF0) - value = 0xF0; - *toStore = value; + x = task->tTopBannerX + Sin(sinIndex, 16); + if (x < 0) + x = 1; + if (x > DISPLAY_WIDTH) + x = DISPLAY_WIDTH; + *toStore = x; } - for (; i < 160; i++, toStore++, r5 += 0x10) + + // Update bottom banner + for (; i < DISPLAY_HEIGHT; i++, toStore++, sinIndex += 16) { - value = task->tData3 - Sin(r5, 0x10); - if (value < 0) - value = 0; - if (value > 0xEF) - value = 0xEF; - *toStore = (value << 8) | (0xF0); + x = task->tBottomBannerX - Sin(sinIndex, 16); + if (x < 0) + x = 0; + if (x > DISPLAY_WIDTH - 1) + x = DISPLAY_WIDTH - 1; + *toStore = (x << 8) | DISPLAY_WIDTH; } - task->tData2 += 8; - task->tData3 -= 8; - if (task->tData2 > 0xF0) - task->tData2 = 0xF0; - if (task->tData3 < 0) - task->tData3 = 0; - mergedValue = *(s32*)(&task->tData2); - if (mergedValue == 0xF0) + // Slide banners across screen + task->tTopBannerX += 8; + task->tBottomBannerX -= 8; + + if (task->tTopBannerX > DISPLAY_WIDTH) + task->tTopBannerX = DISPLAY_WIDTH; + if (task->tBottomBannerX < 0) + task->tBottomBannerX = 0; + + mergedValue = *(s32*)(&task->tTopBannerX); + if (mergedValue == DISPLAY_WIDTH) task->tState++; - sTransitionStructPtr->BG0HOFS_1 -= 8; - sTransitionStructPtr->BG0HOFS_2 += 8; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->BG0HOFS_Lower -= 8; + sTransitionData->BG0HOFS_Upper += 8; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Mugshot_Func4(struct Task *task) +static bool8 Mugshot_StartOpponentSlide(struct Task *task) { u8 i; u16* toStore; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - for (i = 0, toStore = gScanlineEffectRegBuffers[0]; i < 160; i++, toStore++) - { - *toStore = 0xF0; - } + for (i = 0, toStore = gScanlineEffectRegBuffers[0]; i < DISPLAY_HEIGHT; i++, toStore++) + *toStore = DISPLAY_WIDTH; task->tState++; - task->tData1 = 0; - task->tData2 = 0; - task->tData3 = 0; - sTransitionStructPtr->BG0HOFS_1 -= 8; - sTransitionStructPtr->BG0HOFS_2 += 8; - - SetTrainerPicSlideTable(task->tOpponentSpriteId, 0); - SetTrainerPicSlideTable(task->tPlayerSpriteId, 1); + + // Clear old data + task->tSinIndex = 0; + task->tTopBannerX = 0; + task->tBottomBannerX = 0; + + sTransitionData->BG0HOFS_Lower -= 8; + sTransitionData->BG0HOFS_Upper += 8; + + SetTrainerPicSlideDirection(task->tOpponentSpriteId, 0); + SetTrainerPicSlideDirection(task->tPlayerSpriteId, 1); + + // Start opponent slide IncrementTrainerPicState(task->tOpponentSpriteId); PlaySE(SE_MUGSHOT); - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Mugshot_Func5(struct Task *task) +static bool8 Mugshot_WaitStartPlayerSlide(struct Task *task) { - sTransitionStructPtr->BG0HOFS_1 -= 8; - sTransitionStructPtr->BG0HOFS_2 += 8; + sTransitionData->BG0HOFS_Lower -= 8; + sTransitionData->BG0HOFS_Upper += 8; + + // Start player's slide in once the opponent is finished if (IsTrainerPicSlideDone(task->tOpponentSpriteId)) { task->tState++; @@ -2242,94 +2444,99 @@ static bool8 Phase2_Mugshot_Func5(struct Task *task) return FALSE; } -static bool8 Phase2_Mugshot_Func6(struct Task *task) +static bool8 Mugshot_WaitPlayerSlide(struct Task *task) { - sTransitionStructPtr->BG0HOFS_1 -= 8; - sTransitionStructPtr->BG0HOFS_2 += 8; + sTransitionData->BG0HOFS_Lower -= 8; + sTransitionData->BG0HOFS_Upper += 8; + if (IsTrainerPicSlideDone(task->tPlayerSpriteId)) { - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; SetVBlankCallback(NULL); DmaStop(0); - memset(gScanlineEffectRegBuffers[0], 0, 0x140); - memset(gScanlineEffectRegBuffers[1], 0, 0x140); + memset(gScanlineEffectRegBuffers[0], 0, DISPLAY_HEIGHT * 2); + memset(gScanlineEffectRegBuffers[1], 0, DISPLAY_HEIGHT * 2); SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH); SetGpuReg(REG_OFFSET_BLDY, 0); task->tState++; - task->tData3 = 0; - task->tData4 = 0; - sTransitionStructPtr->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN; - SetVBlankCallback(VBlankCB1_Phase2_Mugshots); + task->tTimer = 0; + task->tFadeSpread = 0; + sTransitionData->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN; + SetVBlankCallback(VBlankCB_MugshotsFadeOut); } return FALSE; } -static bool8 Phase2_Mugshot_Func7(struct Task *task) +static bool8 Mugshot_GradualWhiteFade(struct Task *task) { - bool32 r6; + bool32 active; - sTransitionStructPtr->VBlank_DMA = FALSE; - r6 = TRUE; - sTransitionStructPtr->BG0HOFS_1 -= 8; - sTransitionStructPtr->BG0HOFS_2 += 8; + sTransitionData->VBlank_DMA = FALSE; + active = TRUE; + sTransitionData->BG0HOFS_Lower -= 8; + sTransitionData->BG0HOFS_Upper += 8; - if (task->tData4 < 0x50) - task->tData4 += 2; - if (task->tData4 > 0x50) - task->tData4 = 0x50; + if (task->tFadeSpread < DISPLAY_HEIGHT / 2) + task->tFadeSpread += 2; + if (task->tFadeSpread > DISPLAY_HEIGHT / 2) + task->tFadeSpread = DISPLAY_HEIGHT / 2; - if (++task->tData3 & 1) + if (++task->tTimer & 1) { s16 i; - for (i = 0, r6 = FALSE; i <= task->tData4; i++) + for (i = 0, active = FALSE; i <= task->tFadeSpread; i++) { - s16 index1 = 0x50 - i; - s16 index2 = 0x50 + i; + // Fade starts in middle of screen and + // spreads outwards in both directions. + s16 index1 = DISPLAY_HEIGHT / 2 - i; + s16 index2 = DISPLAY_HEIGHT / 2 + i; if (gScanlineEffectRegBuffers[0][index1] <= 15) { - r6 = TRUE; + active = TRUE; gScanlineEffectRegBuffers[0][index1]++; } if (gScanlineEffectRegBuffers[0][index2] <= 15) { - r6 = TRUE; + active = TRUE; gScanlineEffectRegBuffers[0][index2]++; } } } - if (task->tData4 == 0x50 && !r6) + if (task->tFadeSpread == DISPLAY_HEIGHT / 2 && !active) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Mugshot_Func8(struct Task *task) +// Set palette to white to replace the scanline white fade +// before the screen fades to black. +static bool8 Mugshot_InitFadeWhiteToBlack(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - BlendPalettes(PALETTES_ALL, 0x10, RGB_WHITE); - sTransitionStructPtr->BLDCNT = 0xFF; - task->tData3 = 0; + sTransitionData->VBlank_DMA = FALSE; + BlendPalettes(PALETTES_ALL, 16, RGB_WHITE); + sTransitionData->BLDCNT = 0xFF; + task->tTimer = 0; task->tState++; return TRUE; } -static bool8 Phase2_Mugshot_Func9(struct Task *task) +static bool8 Mugshot_FadeToBlack(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - task->tData3++; - memset(gScanlineEffectRegBuffers[0], task->tData3, 0x140); - if (task->tData3 > 15) + task->tTimer++; + memset(gScanlineEffectRegBuffers[0], task->tTimer, DISPLAY_HEIGHT * 2); + if (task->tTimer > 15) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Mugshot_Func10(struct Task *task) +static bool8 Mugshot_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); @@ -2337,60 +2544,56 @@ static bool8 Phase2_Mugshot_Func10(struct Task *task) return FALSE; } -static void VBlankCB0_Phase2_Mugshots(void) +static void VBlankCB_Mugshots(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_BG0VOFS = sTransitionStructPtr->BG0VOFS; - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); + if (sTransitionData->VBlank_DMA != 0) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_BG0VOFS = sTransitionData->BG0VOFS; + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS); } -static void VBlankCB1_Phase2_Mugshots(void) +static void VBlankCB_MugshotsFadeOut(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - DmaSet(0, gScanlineEffectRegBuffers[1], ®_BLDY, 0xA2400001); + if (sTransitionData->VBlank_DMA != 0) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_BLDCNT = sTransitionData->BLDCNT; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BLDY, B_TRANS_DMA_FLAGS); } -static void HBlankCB_Phase2_Mugshots(void) +static void HBlankCB_Mugshots(void) { - if (REG_VCOUNT < 80) - REG_BG0HOFS = sTransitionStructPtr->BG0HOFS_1; + if (REG_VCOUNT < DISPLAY_HEIGHT / 2) + REG_BG0HOFS = sTransitionData->BG0HOFS_Lower; else - REG_BG0HOFS = sTransitionStructPtr->BG0HOFS_2; + REG_BG0HOFS = sTransitionData->BG0HOFS_Upper; } -// data fields for player/opponent sprites in mugshots -#define sState data[0] -#define sOffsetX data[1] -#define sOffsetX2 data[2] -#define sDone data[6] -#define sSlideTableId data[7] - -static void Mugshots_CreateOpponentPlayerSprites(struct Task *task) +static void Mugshots_CreateTrainerPics(struct Task *task) { struct Sprite *opponentSprite, *playerSprite; s16 mugshotId = task->tMugshotId; task->tOpponentSpriteId = CreateTrainerSprite(sMugshotsTrainerPicIDsTable[mugshotId], - sMugshotsOpponentCoords[mugshotId][0] - 32, - sMugshotsOpponentCoords[mugshotId][1] + 42, - 0, gDecompressionBuffer); - task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), DISPLAY_WIDTH + 32, 106, 0, gDecompressionBuffer); + sMugshotsOpponentCoords[mugshotId][0] - 32, + sMugshotsOpponentCoords[mugshotId][1] + 42, + 0, gDecompressionBuffer); + task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), + DISPLAY_WIDTH + 32, + 106, + 0, gDecompressionBuffer); opponentSprite = &gSprites[task->tOpponentSpriteId]; playerSprite = &gSprites[task->tPlayerSpriteId]; - opponentSprite->callback = SpriteCb_TrainerPic; - playerSprite->callback = SpriteCb_TrainerPic; + opponentSprite->callback = SpriteCB_MugshotTrainerPic; + playerSprite->callback = SpriteCB_MugshotTrainerPic; opponentSprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE; playerSprite->oam.affineMode = ST_OAM_AFFINE_DOUBLE; @@ -2411,68 +2614,75 @@ static void Mugshots_CreateOpponentPlayerSprites(struct Task *task) SetOamMatrixRotationScaling(playerSprite->oam.matrixNum, -512, 512, 0); } -static void SpriteCb_TrainerPic(struct Sprite *sprite) +static void SpriteCB_MugshotTrainerPic(struct Sprite *sprite) { - while (sTrainerPicSpriteCbs[sprite->sState](sprite)); + while (sMugshotTrainerPicFuncs[sprite->sState](sprite)); } -static bool8 TrainerPicCb_Nothing(struct Sprite *sprite) +// Wait until IncrementTrainerPicState is called +static bool8 MugshotTrainerPic_Pause(struct Sprite *sprite) { return FALSE; } -static bool8 TrainerPicCb_SetSlideOffsets(struct Sprite *sprite) +static bool8 MugshotTrainerPic_Init(struct Sprite *sprite) { - s16 offfsets1[ARRAY_COUNT(sTrainerPicSlideOffsets1)]; - s16 offfsets2[ARRAY_COUNT(sTrainerPicSlideOffsets2)]; + s16 speeds[ARRAY_COUNT(sTrainerPicSlideSpeeds)]; + s16 accels[ARRAY_COUNT(sTrainerPicSlideAccels)]; - memcpy(offfsets1, sTrainerPicSlideOffsets1, sizeof(sTrainerPicSlideOffsets1)); - memcpy(offfsets2, sTrainerPicSlideOffsets2, sizeof(sTrainerPicSlideOffsets2)); + memcpy(speeds, sTrainerPicSlideSpeeds, sizeof(sTrainerPicSlideSpeeds)); + memcpy(accels, sTrainerPicSlideAccels, sizeof(sTrainerPicSlideAccels)); sprite->sState++; - sprite->sOffsetX = offfsets1[sprite->sSlideTableId]; - sprite->sOffsetX2 = offfsets2[sprite->sSlideTableId]; + sprite->sSlideSpeed = speeds[sprite->sSlideDir]; + sprite->sSlideAccel = accels[sprite->sSlideDir]; return TRUE; } -// fast slide to around middle screen -static bool8 TrainerPicCb_Slide1(struct Sprite *sprite) +static bool8 MugshotTrainerPic_Slide(struct Sprite *sprite) { - sprite->x += sprite->sOffsetX; - if (sprite->sSlideTableId && sprite->x < 133) + sprite->x += sprite->sSlideSpeed; + + // Advance state when pic passes ~40% of screen + if (sprite->sSlideDir && sprite->x < DISPLAY_WIDTH - 107) sprite->sState++; - else if (!sprite->sSlideTableId && sprite->x > 103) + else if (!sprite->sSlideDir && sprite->x > 103) sprite->sState++; return FALSE; } -// slower but accelerating slide -static bool8 TrainerPicCb_Slide2(struct Sprite *sprite) +static bool8 MugshotTrainerPic_SlideSlow(struct Sprite *sprite) { - sprite->sOffsetX += sprite->sOffsetX2; - sprite->x += sprite->sOffsetX; - if (sprite->sOffsetX == 0) + // Add acceleration value to speed, then add speed. + // For both sides acceleration is opposite speed, so slide slows down. + sprite->sSlideSpeed += sprite->sSlideAccel; + sprite->x += sprite->sSlideSpeed; + + // Advance state when slide comes to a stop + if (sprite->sSlideSpeed == 0) { sprite->sState++; - sprite->sOffsetX2 = -sprite->sOffsetX2; + sprite->sSlideAccel = -sprite->sSlideAccel; sprite->sDone = TRUE; } return FALSE; } -// Has no practical effect -static bool8 TrainerPicCb_Slide3(struct Sprite *sprite) +// Slides trainer pic offscreen. This is never reached, because it's preceded +// by a second MugshotTrainerPic_Pause, and IncrementTrainerPicState is +// only called once per trainer pic. +static bool8 MugshotTrainerPic_SlideOffscreen(struct Sprite *sprite) { - sprite->sOffsetX += sprite->sOffsetX2; - sprite->x += sprite->sOffsetX; - if (sprite->x < -31 || sprite->x > 271) + sprite->sSlideSpeed += sprite->sSlideAccel; + sprite->x += sprite->sSlideSpeed; + if (sprite->x < -31 || sprite->x > DISPLAY_WIDTH + 31) sprite->sState++; return FALSE; } -static void SetTrainerPicSlideTable(s16 spriteId, s16 arrId) +static void SetTrainerPicSlideDirection(s16 spriteId, s16 dirId) { - gSprites[spriteId].sSlideTableId = arrId; + gSprites[spriteId].sSlideDir = dirId; } static void IncrementTrainerPicState(s16 spriteId) @@ -2486,106 +2696,124 @@ static s16 IsTrainerPicSlideDone(s16 spriteId) } #undef sState -#undef sOffsetX -#undef sOffsetX2 +#undef sSlideSpeed +#undef sSlideAccel #undef sDone -#undef sSlideTableId +#undef sSlideDir +#undef tSinIndex +#undef tTopBannerX +#undef tBottomBannerX +#undef tTimer +#undef tFadeSpread +#undef tOpponentSpriteId +#undef tPlayerSpriteId +#undef tMugshotId + +//-------------------- +// B_TRANSITION_SLICE +//-------------------- -static void Phase2Task_Slice(u8 taskId) +#define tEffectX data[1] +#define tSpeed data[2] +#define tAccel data[3] + +static void Task_Slice(u8 taskId) { - while (sPhase2_Slice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sSlice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Slice_Func1(struct Task *task) +static bool8 Slice_Init(struct Task *task) { u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - task->tData2 = 256; - task->tData3 = 1; - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; - sTransitionStructPtr->VBlank_DMA = FALSE; + task->tSpeed = 1 << 8; + task->tAccel = 1; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = 0; + sTransitionData->WIN0V = DISPLAY_HEIGHT; + sTransitionData->VBlank_DMA = FALSE; - for (i = 0; i < 160; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { - gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; - gScanlineEffectRegBuffers[1][160 + i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraX; + gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH; } EnableInterrupts(INTR_FLAG_HBLANK); SetGpuRegBits(REG_OFFSET_DISPSTAT, DISPSTAT_HBLANK_INTR); - SetVBlankCallback(VBlankCB_Phase2_Slice); - SetHBlankCallback(HBlankCB_Phase2_Slice); + SetVBlankCallback(VBlankCB_Slice); + SetHBlankCallback(HBlankCB_Slice); task->tState++; return TRUE; } -static bool8 Phase2_Slice_Func2(struct Task *task) +static bool8 Slice_Main(struct Task *task) { u16 i; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - task->tData1 += (task->tData2 >> 8); - if (task->tData1 > 0xF0) - task->tData1 = 0xF0; - if (task->tData2 <= 0xFFF) - task->tData2 += task->tData3; - if (task->tData3 < 128) - task->tData3 <<= 1; // multiplying by two + task->tEffectX += (task->tSpeed >> 8); + if (task->tEffectX > DISPLAY_WIDTH) + task->tEffectX = DISPLAY_WIDTH; + if (task->tSpeed <= 0xFFF) + task->tSpeed += task->tAccel; + if (task->tAccel < 128) + task->tAccel <<= 1; // multiplying by two - for (i = 0; i < 160; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { u16 *storeLoc1 = &gScanlineEffectRegBuffers[0][i]; - u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + 160]; - if (i & 1) + u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + DISPLAY_HEIGHT]; + + // Alternate rows + if (i % 2) { - *storeLoc1 = sTransitionStructPtr->field_14 + task->tData1; - *storeLoc2 = 0xF0 - task->tData1; + *storeLoc1 = sTransitionData->cameraX + task->tEffectX; + *storeLoc2 = DISPLAY_WIDTH - task->tEffectX; } else { - *storeLoc1 = sTransitionStructPtr->field_14 - task->tData1; - *storeLoc2 = (task->tData1 << 8) | (0xF1); + *storeLoc1 = sTransitionData->cameraX - task->tEffectX; + *storeLoc2 = (task->tEffectX << 8) | (DISPLAY_WIDTH + 1); } } - if (task->tData1 > 0xEF) + if (task->tEffectX >= DISPLAY_WIDTH) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Slice_Func3(struct Task *task) +static bool8 Slice_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_Slice)); + DestroyTask(FindTaskIdByFunc(Task_Slice)); return FALSE; } -static void VBlankCB_Phase2_Slice(void) +static void VBlankCB_Slice(void) { DmaStop(0); VBlankCB_BattleTransition(); - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); - DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 4); + DmaSet(0, &gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT], ®_WIN0H, B_TRANS_DMA_FLAGS); } -static void HBlankCB_Phase2_Slice(void) +static void HBlankCB_Slice(void) { - if (REG_VCOUNT < 160) + if (REG_VCOUNT < DISPLAY_HEIGHT) { u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; @@ -2594,77 +2822,92 @@ static void HBlankCB_Phase2_Slice(void) } } -static void Phase2Task_ShredSplit(u8 taskId) +#undef tEffectX +#undef tSpeed +#undef tAccel + +//-------------------------- +// B_TRANSITION_SHRED_SPLIT +//-------------------------- + +// Data starts at 4. Possible it shared data +// with Slice above, which ends at 3. +#define tDelayTimer data[4] +#define tExtent data[5] +#define tDelay data[6] + +static void Task_ShredSplit(u8 taskId) { - while (sPhase2_ShredSplit_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sShredSplit_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_ShredSplit_Func1(struct Task *task) +static bool8 ShredSplit_Init(struct Task *task) { u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = 0; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 0xA0; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { - gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; - gScanlineEffectRegBuffers[1][0xA0 + i] = 0xF0; - gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_14; - gScanlineEffectRegBuffers[0][0xA0 + i] = 0xF0; - gScanlineEffectRegBuffers[0][0x140 + i] = 0; - gScanlineEffectRegBuffers[0][0x1E0 + i] = 0x100; - gScanlineEffectRegBuffers[0][0x280 + i] = 1; + gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraX; + gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH; + gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraX; + gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT + i] = DISPLAY_WIDTH; + gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 2 + i] = 0; + gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 3 + i] = 256; + gScanlineEffectRegBuffers[0][DISPLAY_HEIGHT * 4 + i] = 1; } - task->tData4 = 0; - task->tData5 = 0; - task->tData6 = 7; + task->tDelayTimer = 0; + task->tExtent = 0; + task->tDelay = 7; EnableInterrupts(INTR_FLAG_HBLANK); - SetVBlankCallback(VBlankCB_Phase2_Slice); - SetHBlankCallback(HBlankCB_Phase2_Slice); + SetVBlankCallback(VBlankCB_Slice); + SetHBlankCallback(HBlankCB_Slice); task->tState++; return TRUE; } -static bool8 Phase2_ShredSplit_Func2(struct Task *task) +static bool8 ShredSplit_Main(struct Task *task) { u16 i, j, k; - u8 arr1[ARRAY_COUNT(gUnknown_085C8C64)]; - s16 arr2[ARRAY_COUNT(gUnknown_085C8C66)]; - u8 var; + u8 baseY[ARRAY_COUNT(sShredSplit_SectionYCoords)]; + s16 moveDirs[ARRAY_COUNT(sShredSplit_SectionMoveDirs)]; + u8 linesFinished; u16 *ptr4, *ptr3, *ptr1, *ptr2; - s16 unkVar; + s16 y; - memcpy(arr1, gUnknown_085C8C64, sizeof(arr1)); - memcpy(arr2, gUnknown_085C8C66, sizeof(arr2)); + memcpy(baseY, sShredSplit_SectionYCoords, sizeof(baseY)); + memcpy(moveDirs, sShredSplit_SectionMoveDirs, sizeof(moveDirs)); - sTransitionStructPtr->VBlank_DMA = FALSE; - var = 0; + sTransitionData->VBlank_DMA = FALSE; + linesFinished = 0; - for (i = 0; i <= task->tData5; i++) + for (i = 0; i <= task->tExtent; i++) { + // Slide half of the pixel rows (alternating) right for (j = 0; j < 2; j++) { for (k = 0; k < 2; k++) { - unkVar = (arr1[j]) + (arr2[k] * -(i) * 2); - if (unkVar >= 0 && (unkVar != 79 || j != 1)) + y = baseY[j] + (moveDirs[k] * -i * 2); + if (y >= 0 && (y != DISPLAY_HEIGHT / 2 - 1 || j != 1)) { - ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; - ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; - ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; - if (*ptr4 > 0xEF) + ptr4 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 2]; + ptr3 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 3]; + ptr1 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 4]; + if (*ptr4 >= DISPLAY_WIDTH) { - *ptr4 = 0xF0; - var++; + *ptr4 = DISPLAY_WIDTH; + linesFinished++; } else { @@ -2674,10 +2917,10 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; - ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; - *ptr2 = sTransitionStructPtr->field_14 + *ptr4; - *ptr3 = 0xF0 - *ptr4; + ptr2 = &gScanlineEffectRegBuffers[0][y]; + ptr3 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT]; + *ptr2 = sTransitionData->cameraX + *ptr4; + *ptr3 = DISPLAY_WIDTH - *ptr4; if (i == 0) break; @@ -2685,20 +2928,21 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) } } + // Slide the other half of the rows left for (j = 0; j < 2; j++) { for (k = 0; k < 2; k++) { - unkVar = (arr1[j] + 1) + (arr2[k] * -(i) * 2); - if (unkVar <= 160 && (unkVar != 80 || j != 1)) + y = baseY[j] + 1 + (moveDirs[k] * -i * 2); + if (y <= DISPLAY_HEIGHT && (y != DISPLAY_HEIGHT / 2 || j != 1)) { - ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; - ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; - ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; - if (*ptr4 > 0xEF) + ptr4 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 2]; + ptr3 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 3]; + ptr1 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT * 4]; + if (*ptr4 >= DISPLAY_WIDTH) { - *ptr4 = 0xF0; - var++; + *ptr4 = DISPLAY_WIDTH; + linesFinished++; } else { @@ -2708,10 +2952,10 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; - ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; - *ptr2 = sTransitionStructPtr->field_14 - *ptr4; - *ptr3 = (*ptr4 << 8) | (0xF1); + ptr2 = &gScanlineEffectRegBuffers[0][y]; + ptr3 = &gScanlineEffectRegBuffers[0][y + DISPLAY_HEIGHT]; + *ptr2 = sTransitionData->cameraX - *ptr4; + *ptr3 = (*ptr4 << 8) | (DISPLAY_WIDTH + 1); if (i == 0) break; @@ -2720,14 +2964,22 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) } } - if (--task->tData4 < 0) - task->tData4 = 0; - if (task->tData4 <= 0 && task->tData5 + 1 <= 20) - task->tData4 = task->tData6, task->tData5++; - if (var > 0x9F) + // Count down to next move + if (--task->tDelayTimer < 0) + task->tDelayTimer = 0; + + // Try increase effect's extent + if (task->tDelayTimer <= 0 && task->tExtent + 1 <= DISPLAY_HEIGHT / 8) + { + task->tDelayTimer = task->tDelay; + task->tExtent++; + } + + // All lines have reached screen width, move on. + if (linesFinished >= DISPLAY_HEIGHT) task->tState++; - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } @@ -2735,16 +2987,17 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) // is always false, resulting in the game being stuck in an infinite loop. // It's possible this transition is only partially // done and the second part was left out. -static bool8 Phase2_ShredSplit_Func3(struct Task *task) +// In any case removing or bypassing this state allows the transition to finish. +static bool8 ShredSplit_BrokenCheck(struct Task *task) { u16 i; bool32 done = TRUE; u16 checkVar2 = 0xFF10; - for (i = 0; i < 0xA0; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { - if (gScanlineEffectRegBuffers[1][i] != 0xF0 && gScanlineEffectRegBuffers[1][i] != checkVar2) - done = FALSE; // a break statement should be put here + if (gScanlineEffectRegBuffers[1][i] != DISPLAY_WIDTH && gScanlineEffectRegBuffers[1][i] != checkVar2) + done = FALSE; } if (done == TRUE) @@ -2753,54 +3006,68 @@ static bool8 Phase2_ShredSplit_Func3(struct Task *task) return FALSE; } -static bool8 Phase2_ShredSplit_Func4(struct Task *task) +static bool8 ShredSplit_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_ShredSplit)); + DestroyTask(FindTaskIdByFunc(Task_ShredSplit)); return FALSE; } -static void Phase2Task_Blackhole1(u8 taskId) +#undef tDelayTimer +#undef tExtent +#undef tDelay + +//----------------------------------------------------------- +// B_TRANSITION_BLACKHOLE and B_TRANSITION_BLACKHOLE_PULSATE +//----------------------------------------------------------- + +#define tRadius data[1] +#define tGrowSpeed data[2] +#define tSinIndex data[5] +#define tVibrateId data[6] +#define tAmplitude data[6] // Used differently by the two transitions +#define tFlag data[7] // Used generally to indicate an action has taken place. + +static void Task_Blackhole(u8 taskId) { - while (sPhase2_Blackhole1_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sBlackhole_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_Blackhole2(u8 taskId) +static void Task_BlackholePulsate(u8 taskId) { - while (sPhase2_Blackhole2_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sBlackholePulsate_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Blackhole_Func1(struct Task *task) +// Init is shared by both transitions +static bool8 Blackhole_Init(struct Task *task) { s32 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->WININ = 0; - sTransitionStructPtr->WINOUT = WINOUT_WIN01_ALL; - sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = 0; + sTransitionData->WINOUT = WINOUT_WIN01_ALL; + sTransitionData->WIN0H = DISPLAY_WIDTH; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 0xA0; i++) - { + for (i = 0; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[1][i] = 0; - } - SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + SetVBlankCallback(VBlankCB_CircularMask); task->tState++; - task->tData1 = 1; - task->tData2 = 0x100; - task->tFuncState = 0; + task->tRadius = 1; + task->tGrowSpeed = 1 << 8; + task->tFlag = FALSE; return FALSE; } -static bool8 Phase2_Blackhole1_Func3(struct Task *task) +static bool8 Blackhole_GrowEnd(struct Task *task) { - if (task->tFuncState == 1) + if (task->tFlag == TRUE) { DmaStop(0); SetVBlankCallback(NULL); @@ -2808,141 +3075,161 @@ static bool8 Phase2_Blackhole1_Func3(struct Task *task) } else { - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tData2 < 0x400) - task->tData2 += 0x80; - if (task->tData1 < 0xA0) - task->tData1 += (task->tData2 >> 8); - if (task->tData1 > 0xA0) - task->tData1 = 0xA0; - sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); - if (task->tData1 == 0xA0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tGrowSpeed < 1024) + task->tGrowSpeed += 128; + if (task->tRadius < DISPLAY_HEIGHT) + task->tRadius += task->tGrowSpeed >> 8; + if (task->tRadius > DISPLAY_HEIGHT) + task->tRadius = DISPLAY_HEIGHT; + SetCircularMask(gScanlineEffectRegBuffers[0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, task->tRadius); + if (task->tRadius == DISPLAY_HEIGHT) { - task->tFuncState = 1; + task->tFlag = TRUE; FadeScreenBlack(); } else { - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; } } return FALSE; } -static bool8 Phase2_Blackhole1_Func2(struct Task *task) +static bool8 Blackhole_Vibrate(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tFuncState == 0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tFlag == FALSE) { - task->tFuncState++; - task->tData1 = 0x30; - task->tData6 = 0; + task->tFlag++; + task->tRadius = 48; + task->tVibrateId = 0; } - task->tData1 += gUnknown_085C8C80[task->tData6]; - task->tData6 = (task->tData6 + 1) % 2; - sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); - if (task->tData1 < 9) + task->tRadius += sBlackhole_Vibrations[task->tVibrateId]; + task->tVibrateId = (task->tVibrateId + 1) % (int)ARRAY_COUNT(sBlackhole_Vibrations); + SetCircularMask(gScanlineEffectRegBuffers[0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, task->tRadius); + if (task->tRadius < 9) { task->tState++; - task->tFuncState = 0; + task->tFlag = FALSE; } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Blackhole2_Func2(struct Task *task) +static bool8 BlackholePulsate_Main(struct Task *task) { u16 index; // should be s16 I think s16 amplitude; - sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->tFuncState == 0) + sTransitionData->VBlank_DMA = FALSE; + if (task->tFlag == FALSE) { - task->tFuncState++; - task->tData5 = 2; - task->tData6 = 2; + task->tFlag++; + task->tSinIndex = 2; + task->tAmplitude = 2; } - if (task->tData1 > 0xA0) - task->tData1 = 0xA0; - sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); - if (task->tData1 == 0xA0) + if (task->tRadius > DISPLAY_HEIGHT) + task->tRadius = DISPLAY_HEIGHT; + + SetCircularMask(gScanlineEffectRegBuffers[0], DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, task->tRadius); + if (task->tRadius == DISPLAY_HEIGHT) { DmaStop(0); FadeScreenBlack(); DestroyTask(FindTaskIdByFunc(task->func)); } - index = task->tData5; - if ((task->tData5 & 0xFF) <= 128) + index = task->tSinIndex; + if ((task->tSinIndex & 0xFF) <= 128) { - amplitude = task->tData6; - task->tData5 += 8; + amplitude = task->tAmplitude; + task->tSinIndex += 8; } else { - amplitude = task->tData6 - 1; - task->tData5 += 16; + amplitude = task->tAmplitude - 1; + task->tSinIndex += 16; } - task->tData1 += Sin(index & 0xFF, amplitude); + task->tRadius += Sin(index & 0xFF, amplitude); - if (task->tData1 <= 0) - task->tData1 = 1; - if (task->tData5 > 0xFE) - task->tData5 >>= 8, task->tData6++; + if (task->tRadius <= 0) + task->tRadius = 1; + + if (task->tSinIndex >= 0xFF) + { + task->tSinIndex >>= 8; + task->tAmplitude++; + } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static void Phase2Task_RectangularSpiral(u8 taskId) +#undef tRadius +#undef tGrowSpeed +#undef tSinIndex +#undef tVibrateId +#undef tAmplitude +#undef tFlag + +//--------------------------------- +// B_TRANSITION_RECTANGULAR_SPIRAL +//--------------------------------- + +static void Task_RectangularSpiral(u8 taskId) { - while (sPhase2_RectangularSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRectangularSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_RectangularSpiral_Func1(struct Task *task) +static bool8 RectangularSpiral_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); CpuCopy16(sShrinkingBoxTileset, tileset, 0x20); - CpuCopy16(sShrinkingBoxTileset + 0x70, tileset + 0x20, 0x20); - CpuFill16(0xF000, tilemap, 0x800); - LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); + CpuCopy16(&sShrinkingBoxTileset[0x70], &tileset[0x20], 0x20); + CpuFill16(0xF0 << 8, tilemap, BG_SCREEN_SIZE); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball)); - task->tData3 = 1; + task->data[3] = 1; task->tState++; - sRectangularSpiralTransition[0].field_0 = 0; - sRectangularSpiralTransition[0].field_2 = -1; - sRectangularSpiralTransition[0].field_4 = 1; - sRectangularSpiralTransition[0].field_6 = 308; - sRectangularSpiralTransition[0].field_8 = 0; - - sRectangularSpiralTransition[1].field_0 = 0; - sRectangularSpiralTransition[1].field_2 = -1; - sRectangularSpiralTransition[1].field_4 = 1; - sRectangularSpiralTransition[1].field_6 = 308; - sRectangularSpiralTransition[1].field_8 = 0; - - sRectangularSpiralTransition[2].field_0 = 0; - sRectangularSpiralTransition[2].field_2 = -3; - sRectangularSpiralTransition[2].field_4 = 1; - sRectangularSpiralTransition[2].field_6 = 307; - sRectangularSpiralTransition[2].field_8 = 0; - - sRectangularSpiralTransition[3].field_0 = 0; - sRectangularSpiralTransition[3].field_2 = -3; - sRectangularSpiralTransition[3].field_4 = 1; - sRectangularSpiralTransition[3].field_6 = 307; - sRectangularSpiralTransition[3].field_8 = 0; + // Line starting in top left + sRectangularSpiralLines[0].state = SPIRAL_INWARD_START; + sRectangularSpiralLines[0].position = -1; + sRectangularSpiralLines[0].moveIdx = 1; + sRectangularSpiralLines[0].reboundPosition = 308; + sRectangularSpiralLines[0].outward = FALSE; + + // Line starting in bottom right + sRectangularSpiralLines[1].state = SPIRAL_INWARD_START; + sRectangularSpiralLines[1].position = -1; + sRectangularSpiralLines[1].moveIdx = 1; + sRectangularSpiralLines[1].reboundPosition = 308; + sRectangularSpiralLines[1].outward = FALSE; + + // Line starting in top right + sRectangularSpiralLines[2].state = SPIRAL_INWARD_START; + sRectangularSpiralLines[2].position = -3; + sRectangularSpiralLines[2].moveIdx = 1; + sRectangularSpiralLines[2].reboundPosition = 307; + sRectangularSpiralLines[2].outward = FALSE; + + // Line starting in bottom left + sRectangularSpiralLines[3].state = SPIRAL_INWARD_START; + sRectangularSpiralLines[3].position = -3; + sRectangularSpiralLines[3].moveIdx = 1; + sRectangularSpiralLines[3].reboundPosition = 307; + sRectangularSpiralLines[3].outward = FALSE; return FALSE; } -static bool8 Phase2_RectangularSpiral_Func2(struct Task *task) +static bool8 RectangularSpiral_Main(struct Task *task) { u16 *tilemap, *tileset; u8 i; @@ -2951,24 +3238,28 @@ static bool8 Phase2_RectangularSpiral_Func2(struct Task *task) GetBg0TilesDst(&tilemap, &tileset); + // Draw 2 tiles at a time for each spiral line for (i = 0; i < 2; i++) { - for (j = 0; j < ARRAY_COUNT(sRectangularSpiralTransition); j++) + for (j = 0; j < ARRAY_COUNT(sRectangularSpiralLines); j++) { - s16 var = 0, var2 = 0; - s32 var3 = 0; + s16 position = 0; + s16 x = 0, y = 0; - if (sub_8149048(gUnknown_085C8D38[j / 2], &sRectangularSpiralTransition[j])) + if (UpdateRectangularSpiralLine(sRectangularSpiral_MoveDataTables[j / 2], &sRectangularSpiralLines[j])) { + // The line moved to a new position, draw the tile. done = FALSE; - var = sRectangularSpiralTransition[j].field_2; + position = sRectangularSpiralLines[j].position; + + // Invert position for the two lines that start at the bottom. if ((j % 2) == 1) - var = 0x27D - var; + position = 637 - position; - var2 = var % 32; - var3 = var / 32; + x = position % 32; + y = position / 32; - SOME_VRAM_STORE(tilemap, var3, var2, 0xF002); + SET_TILE(tilemap, y, x, 2); } } } @@ -2978,7 +3269,7 @@ static bool8 Phase2_RectangularSpiral_Func2(struct Task *task) return FALSE; } -static bool8 Phase2_RectangularSpiral_Func3(struct Task *task) +static bool8 RectangularSpiral_End(struct Task *task) { DmaStop(0); FadeScreenBlack(); @@ -2986,575 +3277,655 @@ static bool8 Phase2_RectangularSpiral_Func3(struct Task *task) return FALSE; } -static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1) +// Returns TRUE if a tile should be drawn, FALSE otherwise +static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, struct RectangularSpiralLine *line) { - const s16 *array = arg0[arg1->field_0]; - if (array[arg1->field_4] == -1) + const s16 *moveData = moveDataTable[line->state]; + + // Has spiral finished? + // Note that most move data arrays endsin SPIRAL_END but it is + // only ever reached on the final array of spiraling outward. + if (moveData[line->moveIdx] == SPIRAL_END) return FALSE; - // ?? - sUnusedRectangularSpiralVar = array[0]; - sUnusedRectangularSpiralVar = array[1]; - sUnusedRectangularSpiralVar = array[2]; - sUnusedRectangularSpiralVar = array[3]; - - switch (array[0]) + // Presumably saving data for debug. + sDebug_RectangularSpiralData = moveData[0]; + sDebug_RectangularSpiralData = moveData[1]; + sDebug_RectangularSpiralData = moveData[2]; + sDebug_RectangularSpiralData = moveData[3]; + + // Note that for the two lines originating at the bottom the + // position is inverted, so the directions are flipped. + // i.e. position += 1 is right for the top lines and left + // for their inverted partners on the bottom. + switch (moveData[0]) { - case 1: - arg1->field_2 += 0x1; + case MOVE_RIGHT: + line->position += 1; break; - case 2: - arg1->field_2 -= 0x1; + case MOVE_LEFT: + line->position -= 1; break; - case 3: - arg1->field_2 -= 0x20; + case MOVE_UP: + line->position -= 32; break; - case 4: - arg1->field_2 += 0x20; + case MOVE_DOWN: + line->position += 32; break; } - if (arg1->field_2 > 0x27F || array[arg1->field_4] == -1) + // Below check is never true. + // SPIRAL_END was already checked, and position is never >= 640 + if (line->position >= 640 || moveData[line->moveIdx] == SPIRAL_END) return FALSE; - if (arg1->field_8 == 0 && array[arg1->field_4] == -2) + if (!line->outward && moveData[line->moveIdx] == SPIRAL_REBOUND) { - arg1->field_8 = 1; - arg1->field_4 = 1; - arg1->field_2 = arg1->field_6; - arg1->field_0 = 4; + // Line has reached the final point of spiraling inward. + // Time to flip and start spiraling outward. + line->outward = TRUE; + line->moveIdx = 1; + line->position = line->reboundPosition; + line->state = SPIRAL_OUTWARD_START; } - if (arg1->field_2 == array[arg1->field_4]) + // Reached move target, advance to next movement. + if (line->position == moveData[line->moveIdx]) { - (arg1->field_0)++; - if (arg1->field_8 == 1) + line->state++; + if (line->outward == TRUE) { - if (arg1->field_0 > 7) + if (line->state > SPIRAL_OUTWARD_END) { - (arg1->field_4)++; - (arg1->field_0) = 4; + // Still spiraling outward, loop back to the first state + // but use the second set of move targets. + // For example, the 28 in sRectangularSpiral_Major_OutwardUp + line->moveIdx++; + line->state = SPIRAL_OUTWARD_START; } } else { - if (arg1->field_0 > 3) + if (line->state > SPIRAL_INWARD_END) { - (arg1->field_4)++; - (arg1->field_0) = 0; + // Still spiraling inward, loop back to the first state + // but use the second set of move targets. + // For example, the 275 in sRectangularSpiral_Major_InwardRight + line->moveIdx++; + line->state = SPIRAL_INWARD_START; } } } - return TRUE; } -static void Phase2Task_Groudon(u8 taskId) +//---------------------- +// B_TRANSITION_GROUDON +//---------------------- + +#define tTimer data[1] + +static void Task_Groudon(u8 taskId) { - while (sPhase2_Groudon_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sGroudon_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Groudon_Func3(struct Task *task) +static bool8 Groudon_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sGroudon_Tileset, tileset); LZ77UnCompVram(sGroudon_Tilemap, tilemap); task->tState++; - task->tData1 = 0; + task->tTimer = 0; return FALSE; } -static bool8 Phase2_Groudon_Func4(struct Task *task) +static bool8 Groudon_PaletteFlash(struct Task *task) { - if (task->tData1 % 3 == 0) + if (task->tTimer % 3 == 0) { - u16 var = (task->tData1 % 30) / 3; - LoadPalette(sGroudon1_Palette + (var * 16), 0xF0, 0x20); + u16 offset = (task->tTimer % 30) / 3; + LoadPalette(&sGroudon1_Palette[offset * 16], 0xF0, 0x20); } - if (++task->tData1 > 58) + if (++task->tTimer > 58) { task->tState++; - task->tData1 = 0; + task->tTimer = 0; } return FALSE; } -static bool8 Phase2_Groudon_Func5(struct Task *task) +static bool8 Groudon_PaletteBrighten(struct Task *task) { - if (task->tData1 % 5 == 0) + if (task->tTimer % 5 == 0) { - s16 var = task->tData1 / 5; - LoadPalette(sGroudon2_Palette + (var * 16), 0xF0, 0x20); + s16 offset = task->tTimer / 5; + LoadPalette(&sGroudon2_Palette[offset * 16], 0xF0, 0x20); } - if (++task->tData1 > 68) + if (++task->tTimer > 68) { task->tState++; - task->tData1 = 0; - task->tFrames = 30; + task->tTimer = 0; + task->tEndDelay = 30; } return FALSE; } -static void Phase2Task_Rayquaza(u8 taskId) +#undef tTimer +#undef tEndDelay + +//----------------------- +// B_TRANSITION_RAYQUAZA +//----------------------- + +#define tTimer data[1] +#define tGrowSpeed data[2] // Shared from B_TRANSITION_BLACKHOLE +#define tFlag data[7] // Shared from B_TRANSITION_BLACKHOLE + +static void Task_Rayquaza(u8 taskId) { - while (sPhase2_Rayquaza_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sRayquaza_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Rayquaza_Func3(struct Task *task) +static bool8 Rayquaza_Init(struct Task *task) { u16 *tilemap, *tileset; u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(26) | BGCNT_TXT256x512); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); CpuCopy16(sRayquaza_Tileset, tileset, 0x2000); - sTransitionStructPtr->field_20 = 0; + sTransitionData->counter = 0; task->tState++; - LoadPalette(sRayquaza_Palette + 0x50, 0xF0, 0x20); + LoadPalette(&sRayquaza_Palette[0x50], 0xF0, 0x20); - for (i = 0; i < 160; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { gScanlineEffectRegBuffers[0][i] = 0; gScanlineEffectRegBuffers[1][i] = 0x100; } - SetVBlankCallback(VBlankCB_Phase2_Rayquaza); + SetVBlankCallback(VBlankCB_Rayquaza); return FALSE; } -static bool8 Phase2_Rayquaza_Func4(struct Task *task) +static bool8 Rayquaza_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - CpuCopy16(sRayquaza_Tilemap, tilemap, 0x1000); + CpuCopy16(sRayquaza_Tilemap, tilemap, sizeof(sRayquaza_Tilemap)); task->tState++; return FALSE; } -static bool8 Phase2_Rayquaza_Func5(struct Task *task) +static bool8 Rayquaza_PaletteFlash(struct Task *task) { - if ((task->tData1 % 4) == 0) + if ((task->tTimer % 4) == 0) { - u16 value = task->tData1 / 4; + u16 value = task->tTimer / 4; const u16 *palPtr = &sRayquaza_Palette[(value + 5) * 16]; LoadPalette(palPtr, 0xF0, 0x20); } - if (++task->tData1 > 40) + if (++task->tTimer > 40) { task->tState++; - task->tData1 = 0; + task->tTimer = 0; } return FALSE; } -static bool8 Phase2_Rayquaza_Func6(struct Task *task) +static bool8 Rayquaza_FadeToBlack(struct Task *task) { - if (++task->tData1 > 20) + if (++task->tTimer > 20) { task->tState++; - task->tData1 = 0; - BeginNormalPaletteFade(PALETTES_OBJECTS | 0x8000, 2, 0, 0x10, RGB_BLACK); + task->tTimer = 0; + BeginNormalPaletteFade(PALETTES_OBJECTS | (1 << 15), 2, 0, 16, RGB_BLACK); } return FALSE; } -static bool8 Phase2_Rayquaza_Func7(struct Task *task) +static bool8 Rayquaza_WaitFade(struct Task *task) { if (!gPaletteFade.active) { - sTransitionStructPtr->field_20 = 1; + sTransitionData->counter = 1; task->tState++; } - return FALSE; } -static bool8 Phase2_Rayquaza_Func8(struct Task *task) +static bool8 Rayquaza_SetBlack(struct Task *task) { - BlendPalettes(PALETTES_BG & ~(0x8000), 8, 0); - BlendPalettes(PALETTES_OBJECTS | 0x8000, 0, 0); + BlendPalettes(PALETTES_BG & ~(1 << 15), 8, RGB_BLACK); + BlendPalettes(PALETTES_OBJECTS | (1 << 15), 0, RGB_BLACK); task->tState++; return FALSE; } -static bool8 Phase2_Rayquaza_Func9(struct Task *task) +static bool8 Rayquaza_TriRing(struct Task *task) { - if ((task->tData1 % 3) == 0) + if ((task->tTimer % 3) == 0) { - u16 value = task->tData1 / 3; + u16 value = task->tTimer / 3; const u16 *palPtr = &sRayquaza_Palette[(value + 0) * 16]; LoadPalette(palPtr, 0xF0, 0x20); } - if (++task->tData1 >= 40) + if (++task->tTimer >= 40) { u16 i; - sTransitionStructPtr->WININ = 0; - sTransitionStructPtr->WINOUT = WINOUT_WIN01_ALL; - sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = 0; + sTransitionData->WINOUT = WINOUT_WIN01_ALL; + sTransitionData->WIN0H = DISPLAY_WIDTH; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) - { + for (i = 0; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[1][i] = 0; - } - SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + SetVBlankCallback(VBlankCB_CircularMask); task->tState++; - task->tData2 = 0x100; - task->tFuncState = 0; + task->tGrowSpeed = 1 << 8; + task->tFlag = FALSE; ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON); } return FALSE; } -static void VBlankCB_Phase2_Rayquaza(void) +static void VBlankCB_Rayquaza(void) { void *dmaSrc; DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->field_20 == 0) + if (sTransitionData->counter == 0) dmaSrc = gScanlineEffectRegBuffers[0]; - else if (sTransitionStructPtr->field_20 == 1) + else if (sTransitionData->counter == 1) dmaSrc = gScanlineEffectRegBuffers[1]; else dmaSrc = gScanlineEffectRegBuffers[0]; - DmaSet(0, dmaSrc, ®_BG0VOFS, 0xA2400001); + DmaSet(0, dmaSrc, ®_BG0VOFS, B_TRANS_DMA_FLAGS); } -static void Phase2Task_WhiteFade(u8 taskId) +#undef tTimer +#undef tGrowSpeed +#undef tFlag + +//------------------------------ +// B_TRANSITION_WHITE_BARS_FADE +//------------------------------ + +#define sFade data[0] +#define sFinished data[1] +#define sDestroyAttempts data[2] +#define sDelay data[5] +#define sIsMainSprite data[6] + +#define FADE_TARGET (16 << 8) + +static void Task_WhiteBarsFade(u8 taskId) { - while (sPhase2_WhiteFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sWhiteBarsFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_WhiteFade_Func1(struct Task *task) +static bool8 WhiteBarsFade_Init(struct Task *task) { u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN; - sTransitionStructPtr->BLDY = 0; - sTransitionStructPtr->WININ = WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ; - sTransitionStructPtr->WINOUT = WINOUT_WIN01_ALL; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->BLDCNT = BLDCNT_TGT1_ALL | BLDCNT_EFFECT_LIGHTEN; + sTransitionData->BLDY = 0; + sTransitionData->WININ = WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ; + sTransitionData->WINOUT = WINOUT_WIN01_ALL; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) + for (i = 0; i < DISPLAY_HEIGHT; i++) { gScanlineEffectRegBuffers[1][i] = 0; - gScanlineEffectRegBuffers[1][i + 160] = 0xF0; + gScanlineEffectRegBuffers[1][i + DISPLAY_HEIGHT] = DISPLAY_WIDTH; } EnableInterrupts(INTR_FLAG_HBLANK); - SetHBlankCallback(HBlankCB_Phase2_WhiteFade); - SetVBlankCallback(VBlankCB0_Phase2_WhiteFade); + SetHBlankCallback(HBlankCB_WhiteBarsFade); + SetVBlankCallback(VBlankCB_WhiteBarsFade); task->tState++; return FALSE; } -static bool8 Phase2_WhiteFade_Func2(struct Task *task) +static bool8 WhiteBarsFade_StartBars(struct Task *task) { s16 i, posY; - s16 arr1[ARRAY_COUNT(sUnknown_085C8DA0)]; + s16 delays[ARRAY_COUNT(sWhiteBarsFade_StartDelays)]; struct Sprite *sprite; + memcpy(delays, sWhiteBarsFade_StartDelays, sizeof(sWhiteBarsFade_StartDelays)); - memcpy(arr1, sUnknown_085C8DA0, sizeof(sUnknown_085C8DA0)); - for (i = 0, posY = 0; i < 8; i++, posY += 0x14) + for (i = 0, posY = 0; i < NUM_WHITE_BARS; i++, posY += DISPLAY_HEIGHT / NUM_WHITE_BARS) { - sprite = &gSprites[CreateInvisibleSprite(sub_8149864)]; - sprite->x = 0xF0; + sprite = &gSprites[CreateInvisibleSprite(SpriteCB_WhiteBarFade)]; + sprite->x = DISPLAY_WIDTH; sprite->y = posY; - sprite->data[5] = arr1[i]; + sprite->sDelay = delays[i]; } - sprite->data[6]++; + + // Set on one sprite only. This one will enable the DMA + // copy in VBlank and wait for the others to destroy. + sprite->sIsMainSprite++; task->tState++; return FALSE; } -static bool8 Phase2_WhiteFade_Func3(struct Task *task) +static bool8 WhiteBarsFade_WaitBars(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; - if (sTransitionStructPtr->field_20 > 7) + sTransitionData->VBlank_DMA = 0; + if (sTransitionData->counter >= NUM_WHITE_BARS) { - BlendPalettes(PALETTES_ALL, 0x10, 0x7FFF); + BlendPalettes(PALETTES_ALL, 16, RGB_WHITE); task->tState++; } return FALSE; } -static bool8 Phase2_WhiteFade_Func4(struct Task *task) +static bool8 WhiteBarsFade_BlendToBlack(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionData->VBlank_DMA = 0; DmaStop(0); SetVBlankCallback(0); SetHBlankCallback(0); - sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; - sTransitionStructPtr->BLDY = 0; - sTransitionStructPtr->BLDCNT = 0xFF; - sTransitionStructPtr->WININ = WININ_WIN0_ALL; + sTransitionData->WIN0H = DISPLAY_WIDTH; + sTransitionData->BLDY = 0; + sTransitionData->BLDCNT = 0xFF; + sTransitionData->WININ = WININ_WIN0_ALL; - SetVBlankCallback(VBlankCB1_Phase2_WhiteFade); + SetVBlankCallback(VBlankCB_WhiteBarsFade_Blend); task->tState++; return FALSE; } -static bool8 Phase2_WhiteFade_Func5(struct Task *task) +static bool8 WhiteBarsFade_End(struct Task *task) { - if (++sTransitionStructPtr->BLDY > 16) + if (++sTransitionData->BLDY > 16) { FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_WhiteFade)); + DestroyTask(FindTaskIdByFunc(Task_WhiteBarsFade)); } return FALSE; } -static void VBlankCB0_Phase2_WhiteFade(void) +static void VBlankCB_WhiteBarsFade(void) { DmaStop(0); VBlankCB_BattleTransition(); - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); - DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); + REG_BLDCNT = sTransitionData->BLDCNT; + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 4); + DmaSet(0, &gScanlineEffectRegBuffers[1][DISPLAY_HEIGHT], ®_WIN0H, B_TRANS_DMA_FLAGS); } -static void VBlankCB1_Phase2_WhiteFade(void) +static void VBlankCB_WhiteBarsFade_Blend(void) { VBlankCB_BattleTransition(); - REG_BLDY = sTransitionStructPtr->BLDY; - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0H = sTransitionStructPtr->WIN0H; - REG_WIN0V = sTransitionStructPtr->WIN0V; + REG_BLDY = sTransitionData->BLDY; + REG_BLDCNT = sTransitionData->BLDCNT; + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0H = sTransitionData->WIN0H; + REG_WIN0V = sTransitionData->WIN0V; } -static void HBlankCB_Phase2_WhiteFade(void) +static void HBlankCB_WhiteBarsFade(void) { REG_BLDY = gScanlineEffectRegBuffers[1][REG_VCOUNT]; } -static void sub_8149864(struct Sprite *sprite) +static void SpriteCB_WhiteBarFade(struct Sprite *sprite) { - if (sprite->data[5]) + if (sprite->sDelay) { - sprite->data[5]--; - if (sprite->data[6]) - sTransitionStructPtr->VBlank_DMA = 1; + sprite->sDelay--; + if (sprite->sIsMainSprite) + sTransitionData->VBlank_DMA = 1; } else { u16 i; u16* ptr1 = &gScanlineEffectRegBuffers[0][sprite->y]; - u16* ptr2 = &gScanlineEffectRegBuffers[0][sprite->y + 160]; - for (i = 0; i < 20; i++) + u16* ptr2 = &gScanlineEffectRegBuffers[0][sprite->y + DISPLAY_HEIGHT]; + for (i = 0; i < DISPLAY_HEIGHT / NUM_WHITE_BARS; i++) { - ptr1[i] = sprite->data[0] >> 8; - ptr2[i] = (u8)(sprite->x); + ptr1[i] = sprite->sFade >> 8; + ptr2[i] = (u8)sprite->x; } - if (sprite->x == 0 && sprite->data[0] == 0x1000) - sprite->data[1] = 1; + if (sprite->x == 0 && sprite->sFade == FADE_TARGET) + sprite->sFinished = TRUE; sprite->x -= 16; - sprite->data[0] += 0x80; + sprite->sFade += FADE_TARGET / 32; if (sprite->x < 0) sprite->x = 0; - if (sprite->data[0] > 0x1000) - sprite->data[0] = 0x1000; + if (sprite->sFade > FADE_TARGET) + sprite->sFade = FADE_TARGET; - if (sprite->data[6]) - sTransitionStructPtr->VBlank_DMA = 1; + if (sprite->sIsMainSprite) + sTransitionData->VBlank_DMA = 1; - if (sprite->data[1]) + if (sprite->sFinished) { - if (sprite->data[6] == 0 || (sTransitionStructPtr->field_20 > 6 && sprite->data[2]++ > 7)) + // If not the main sprite, destroy self. Otherwise, wait until the + // others have destroyed themselves, or until enough time has elapsed. + if (!sprite->sIsMainSprite || (sTransitionData->counter >= NUM_WHITE_BARS - 1 && sprite->sDestroyAttempts++ > 7)) { - sTransitionStructPtr->field_20++; + sTransitionData->counter++; DestroySprite(sprite); } } } } -static void Phase2Task_GridSquares(u8 taskId) +#undef sFade +#undef sFinished +#undef sDestroyAttempts +#undef sDelay +#undef sIsMainSprite + +//--------------------------- +// B_TRANSITION_GRID_SQUARES +//--------------------------- + +#define tDelay data[1] +#define tShrinkStage data[2] + +static void Task_GridSquares(u8 taskId) { - while (sPhase2_GridSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sGridSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_GridSquares_Func1(struct Task *task) +static bool8 GridSquares_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - CpuSet(sShrinkingBoxTileset, tileset, 0x10); - CpuFill16(0xF000, tilemap, 0x800); - LoadPalette(sFieldEffectPal_Pokeball, 0xF0, 0x20); + CpuSet(sShrinkingBoxTileset, tileset, 16); + CpuFill16(0xF0 << 8, tilemap, BG_SCREEN_SIZE); + LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball)); task->tState++; return FALSE; } -static bool8 Phase2_GridSquares_Func2(struct Task *task) +static bool8 GridSquares_Main(struct Task *task) { u16* tileset; - if (task->tData1 == 0) + if (task->tDelay == 0) { GetBg0TilemapDst(&tileset); - task->tData1 = 3; - task->tData2++; - CpuSet(sShrinkingBoxTileset + (task->tData2 * 8), tileset, 0x10); - if (task->tData2 > 0xD) + task->tDelay = 3; + task->tShrinkStage++; + CpuSet(&sShrinkingBoxTileset[task->tShrinkStage * 8], tileset, 16); + if (task->tShrinkStage > 13) { task->tState++; - task->tData1 = 16; + task->tDelay = 16; } } - task->tData1--; + task->tDelay--; return FALSE; } -static bool8 Phase2_GridSquares_Func3(struct Task *task) +static bool8 GridSquares_End(struct Task *task) { - if (--task->tData1 == 0) + if (--task->tDelay == 0) { FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_GridSquares)); + DestroyTask(FindTaskIdByFunc(Task_GridSquares)); } return FALSE; } -static void Phase2Task_Shards(u8 taskId) +#undef tDelay +#undef tShrinkStage + +//--------------------------- +// B_TRANSITION_ANGLED_WIPES +//--------------------------- + +#define tWipeId data[1] +#define tDir data[2] +#define tDelay data[3] + +static void Task_AngledWipes(u8 taskId) { - while (sPhase2_Shards_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sAngledWipes_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_Shards_Func1(struct Task *task) +static bool8 AngledWipes_Init(struct Task *task) { u16 i; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); - sTransitionStructPtr->WININ = WININ_WIN0_ALL; - sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; + sTransitionData->WININ = WININ_WIN0_ALL; + sTransitionData->WINOUT = 0; + sTransitionData->WIN0V = DISPLAY_HEIGHT; - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[0][i] = 0xF0; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[0][i] = DISPLAY_WIDTH; - CpuSet(gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 0xA0); - SetVBlankCallback(VBlankCB_Phase2_Shards); + CpuSet(gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT); + SetVBlankCallback(VBlankCB_AngledWipes); task->tState++; return TRUE; } -static bool8 Phase2_Shards_Func2(struct Task *task) +static bool8 AngledWipes_SetWipeData(struct Task *task) { - sub_814A1AC(sTransitionStructPtr->data, - sUnknown_085C8DD0[task->tData1][0], - sUnknown_085C8DD0[task->tData1][1], - sUnknown_085C8DD0[task->tData1][2], - sUnknown_085C8DD0[task->tData1][3], - 1, 1); - task->tData2 = sUnknown_085C8DD0[task->tData1][4]; + InitBlackWipe(sTransitionData->data, + sAngledWipes_MoveData[task->tWipeId][0], + sAngledWipes_MoveData[task->tWipeId][1], + sAngledWipes_MoveData[task->tWipeId][2], + sAngledWipes_MoveData[task->tWipeId][3], + 1, 1); + task->tDir = sAngledWipes_MoveData[task->tWipeId][4]; task->tState++; return TRUE; } -static bool8 Phase2_Shards_Func3(struct Task *task) +static bool8 AngledWipes_DoWipe(struct Task *task) { s16 i; - bool8 nextFunc; + bool8 finished; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionData->VBlank_DMA = 0; - for (i = 0, nextFunc = FALSE; i < 16; i++) + for (i = 0, finished = FALSE; i < 16; i++) { - s16 r3 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] >> 8; - s16 r4 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] & 0xFF; - if (task->tData2 == 0) + s16 r3 = gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] >> 8; + s16 r4 = gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] & 0xFF; + if (task->tDir == 0) { - if (r3 < sTransitionStructPtr->data[2]) - r3 = sTransitionStructPtr->data[2]; + // Moving down + if (r3 < sTransitionData->tWipeCurrX) + r3 = sTransitionData->tWipeCurrX; if (r3 > r4) r3 = r4; } else { - if (r4 > sTransitionStructPtr->data[2]) - r4 = sTransitionStructPtr->data[2]; + // Moving up + if (r4 > sTransitionData->tWipeCurrX) + r4 = sTransitionData->tWipeCurrX; if (r4 <= r3) r4 = r3; } - gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); - if (nextFunc) + gScanlineEffectRegBuffers[0][sTransitionData->tWipeCurrY] = (r4) | (r3 << 8); + if (finished) { task->tState++; break; } - else - nextFunc = sub_814A228(sTransitionStructPtr->data, 1, 1); + finished = UpdateBlackWipe(sTransitionData->data, TRUE, TRUE); } - sTransitionStructPtr->VBlank_DMA++; + sTransitionData->VBlank_DMA++; return FALSE; } -static bool8 Phase2_Shards_Func4(struct Task *task) +static bool8 AngledWipes_TryEnd(struct Task *task) { - if (++task->tData1 < 7) + if (++task->tWipeId < NUM_ANGLED_WIPES) { + // Continue with next wipe task->tState++; - task->tData3 = sUnknown_085C8E16[task->tData1 - 1]; + task->tDelay = sAngledWipes_EndDelays[task->tWipeId - 1]; return TRUE; } else { + // End transition DmaStop(0); FadeScreenBlack(); - DestroyTask(FindTaskIdByFunc(Phase2Task_Shards)); + DestroyTask(FindTaskIdByFunc(Task_AngledWipes)); return FALSE; } } -static bool8 Phase2_Shards_Func5(struct Task *task) +static bool8 AngledWipes_StartNext(struct Task *task) { - if (--task->tData3 == 0) + if (--task->tDelay == 0) { + // Return to AngledWipes_SetWipeData task->tState = 1; return TRUE; } @@ -3562,118 +3933,121 @@ static bool8 Phase2_Shards_Func5(struct Task *task) return FALSE; } -static void VBlankCB_Phase2_Shards(void) +static void VBlankCB_AngledWipes(void) { DmaStop(0); VBlankCB_BattleTransition(); - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); - REG_WININ = sTransitionStructPtr->WININ; - REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0V = sTransitionStructPtr->WIN0V; + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); + REG_WININ = sTransitionData->WININ; + REG_WINOUT = sTransitionData->WINOUT; + REG_WIN0V = sTransitionData->WIN0V; REG_WIN0H = gScanlineEffectRegBuffers[1][0]; - DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); -} - -// sub-task for phase2 -#undef tData1 -#undef tData2 -#undef tData3 -#undef tData4 -#undef tData5 -#undef tData6 -#undef tFuncState -#undef tFrames -#undef tOpponentSpriteId -#undef tPlayerSpriteId -#undef tMugshotId + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, B_TRANS_DMA_FLAGS); +} + +#undef tWipeId +#undef tDir +#undef tDelay -// sub-task for sub-task phase -#define tData1 data[1] -#define tData2 data[2] -#define tData3 data[3] -#define tData4 data[4] -#define tData5 data[5] -#define tData6 data[6] -#define tData7 data[7] +//----------------------------------- +// Transition intro +//----------------------------------- -static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) +#define tFadeToGrayDelay data[1] +#define tFadeFromGrayDelay data[2] +#define tNumFades data[3] +#define tFadeToGrayIncrement data[4] +#define tFadeFromGrayIncrement data[5] +#define tDelayTimer data[6] +#define tBlend data[7] + +static void CreateIntroTask(s16 fadeToGrayDelay, s16 fadeFromGrayDelay, s16 numFades, s16 fadeToGrayIncrement, s16 fadeFromGrayIncrement) { - u8 taskId = CreateTask(TransitionPhase1_Task_RunFuncs, 3); - gTasks[taskId].tData1 = a0; - gTasks[taskId].tData2 = a1; - gTasks[taskId].tData3 = a2; - gTasks[taskId].tData4 = a3; - gTasks[taskId].tData5 = a4; - gTasks[taskId].tData6 = a0; + u8 taskId = CreateTask(Task_BattleTransition_Intro, 3); + gTasks[taskId].tFadeToGrayDelay = fadeToGrayDelay; + gTasks[taskId].tFadeFromGrayDelay = fadeFromGrayDelay; + gTasks[taskId].tNumFades = numFades; + gTasks[taskId].tFadeToGrayIncrement = fadeToGrayIncrement; + gTasks[taskId].tFadeFromGrayIncrement = fadeFromGrayIncrement; + gTasks[taskId].tDelayTimer = fadeToGrayDelay; } -static bool8 IsPhase1Done(void) +static bool8 IsIntroTaskDone(void) { - if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE) + if (FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE) return TRUE; else return FALSE; } -void TransitionPhase1_Task_RunFuncs(u8 taskId) +void Task_BattleTransition_Intro(u8 taskId) { - while (sPhase1_TransitionAll_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sTransitionIntroFuncs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase1_TransitionAll_Func1(struct Task *task) +static bool8 TransitionIntro_FadeToGray(struct Task *task) { - if (task->tData6 == 0 || --task->tData6 == 0) + if (task->tDelayTimer == 0 || --task->tDelayTimer == 0) { - task->tData6 = task->tData1; - task->tData7 += task->tData4; - if (task->tData7 > 16) - task->tData7 = 16; - BlendPalettes(PALETTES_ALL, task->tData7, 0x2D6B); + task->tDelayTimer = task->tFadeToGrayDelay; + task->tBlend += task->tFadeToGrayIncrement; + if (task->tBlend > 16) + task->tBlend = 16; + BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11)); } - if (task->tData7 > 15) + if (task->tBlend >= 16) { + // Fade to gray complete, start fade back task->tState++; - task->tData6 = task->tData2; + task->tDelayTimer = task->tFadeFromGrayDelay; } return FALSE; } -static bool8 Phase1_TransitionAll_Func2(struct Task *task) +static bool8 TransitionIntro_FadeFromGray(struct Task *task) { - if (task->tData6 == 0 || --task->tData6 == 0) + if (task->tDelayTimer == 0 || --task->tDelayTimer == 0) { - task->tData6 = task->tData2; - task->tData7 -= task->tData5; - if (task->tData7 < 0) - task->tData7 = 0; - BlendPalettes(PALETTES_ALL, task->tData7, 0x2D6B); + task->tDelayTimer = task->tFadeFromGrayDelay; + task->tBlend -= task->tFadeFromGrayIncrement; + if (task->tBlend < 0) + task->tBlend = 0; + BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11)); } - if (task->tData7 == 0) + if (task->tBlend == 0) { - if (--task->tData3 == 0) - DestroyTask(FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs)); + if (--task->tNumFades == 0) + { + // All fades done, end intro + DestroyTask(FindTaskIdByFunc(Task_BattleTransition_Intro)); + } else { - task->tData6 = task->tData1; + // Fade from gray complete, start new fade + task->tDelayTimer = task->tFadeToGrayDelay; task->tState = 0; } } return FALSE; } -#undef tData1 -#undef tData2 -#undef tData3 -#undef tData4 -#undef tData5 -#undef tData6 -#undef tData7 +#undef tFadeToGrayDelay +#undef tFadeFromGrayDelay +#undef tNumFades +#undef tFadeToGrayIncrement +#undef tFadeFromGrayIncrement +#undef tDelayTimer +#undef tBlend -static void InitTransitionStructVars(void) +//----------------------------------- +// General transition functions +//----------------------------------- + +static void InitTransitionData(void) { - memset(sTransitionStructPtr, 0, sizeof(*sTransitionStructPtr)); - GetCameraOffsetWithPan(&sTransitionStructPtr->field_14, &sTransitionStructPtr->field_16); + memset(sTransitionData, 0, sizeof(*sTransitionData)); + GetCameraOffsetWithPan(&sTransitionData->cameraX, &sTransitionData->cameraY); } static void VBlankCB_BattleTransition(void) @@ -3686,8 +4060,8 @@ static void VBlankCB_BattleTransition(void) static void GetBg0TilemapDst(u16 **tileset) { u16 charBase = REG_BG0CNT >> 2; - charBase <<= 0xE; - *tileset = (u16*)(VRAM + charBase); + charBase <<= 14; + *tileset = (u16*)(BG_VRAM + charBase); } void GetBg0TilesDst(u16 **tilemap, u16 **tileset) @@ -3695,11 +4069,11 @@ void GetBg0TilesDst(u16 **tilemap, u16 **tileset) u16 screenBase = REG_BG0CNT >> 8; u16 charBase = REG_BG0CNT >> 2; - screenBase <<= 0xB; - charBase <<= 0xE; + screenBase <<= 11; + charBase <<= 14; - *tilemap = (u16*)(VRAM + screenBase); - *tileset = (u16*)(VRAM + charBase); + *tilemap = (u16*)(BG_VRAM + screenBase); + *tileset = (u16*)(BG_VRAM + charBase); } static void FadeScreenBlack(void) @@ -3707,207 +4081,237 @@ static void FadeScreenBlack(void) BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); } -static void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) +static void SetSinWave(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) { u8 i; for (i = 0; arrSize > 0; arrSize--, i++, index += indexIncrementer) - { - array[i] = sinAdd + Sin(0xFF & index, amplitude); - } + array[i] = sinAdd + Sin(index & 0xFF, amplitude); } -static void sub_814A014(u16 *array, s16 a1, s16 a2, s16 a3) +static void SetCircularMask(u16 *buffer, s16 centerX, s16 centerY, s16 radius) { s16 i; - memset(array, 0xA, 160 * sizeof(s16)); + memset(buffer, 10, DISPLAY_HEIGHT * sizeof(u16)); for (i = 0; i < 64; i++) { s16 sinResult, cosResult; - s16 toStoreOrr, r2, r3, toStore, r7, r8; - - sinResult = Sin(i, a3); - cosResult = Cos(i, a3); - - toStoreOrr = a1 - sinResult; - toStore = a1 + sinResult; - r7 = a2 - cosResult; - r8 = a2 + cosResult; - - if (toStoreOrr < 0) - toStoreOrr = 0; - if (toStore > 0xF0) - toStore = 0xF0; - if (r7 < 0) - r7 = 0; - if (r8 > 0x9F) - r8 = 0x9F; - - toStore |= (toStoreOrr << 8); - array[r7] = toStore; - array[r8] = toStore; - - cosResult = Cos(i + 1, a3); - r3 = a2 - cosResult; - r2 = a2 + cosResult; - - if (r3 < 0) - r3 = 0; - if (r2 > 0x9F) - r2 = 0x9F; - - while (r7 > r3) - array[--r7] = toStore; - while (r7 < r3) - array[++r7] = toStore; - - while (r8 > r2) - array[--r8] = toStore; - while (r8 < r2) - array[++r8] = toStore; + s16 drawXLeft, drawYBottNext, drawYTopNext, drawX, drawYTop, drawYBott; + + sinResult = Sin(i, radius); + cosResult = Cos(i, radius); + + drawXLeft = centerX - sinResult; + drawX = centerX + sinResult; + drawYTop = centerY - cosResult; + drawYBott = centerY + cosResult; + + if (drawXLeft < 0) + drawXLeft = 0; + if (drawX > DISPLAY_WIDTH) + drawX = DISPLAY_WIDTH; + if (drawYTop < 0) + drawYTop = 0; + if (drawYBott > DISPLAY_HEIGHT - 1) + drawYBott = DISPLAY_HEIGHT - 1; + + drawX |= (drawXLeft << 8); + buffer[drawYTop] = drawX; + buffer[drawYBott] = drawX; + + cosResult = Cos(i + 1, radius); + drawYTopNext = centerY - cosResult; + drawYBottNext = centerY + cosResult; + + if (drawYTopNext < 0) + drawYTopNext = 0; + if (drawYBottNext > DISPLAY_HEIGHT - 1) + drawYBottNext = DISPLAY_HEIGHT - 1; + + while (drawYTop > drawYTopNext) + buffer[--drawYTop] = drawX; + while (drawYTop < drawYTopNext) + buffer[++drawYTop] = drawX; + + while (drawYBott > drawYBottNext) + buffer[--drawYBott] = drawX; + while (drawYBott < drawYBottNext) + buffer[++drawYBott] = drawX; } } -static void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) +static void InitBlackWipe(s16 *data, s16 startX, s16 startY, s16 endX, s16 endY, s16 xMove, s16 yMove) { - data[0] = a1; - data[1] = a2; - data[2] = a1; - data[3] = a2; - data[4] = a3; - data[5] = a4; - data[6] = a5; - data[7] = a6; - data[8] = a3 - a1; - if (data[8] < 0) + tWipeStartX = startX; + tWipeStartY = startY; + tWipeCurrX = startX; + tWipeCurrY = startY; + tWipeEndX = endX; + tWipeEndY = endY; + tWipeXMove = xMove; + tWipeYMove = yMove; + tWipeXDist = endX - startX; + if (tWipeXDist < 0) { - data[8] = -data[8]; - data[6] = -a5; + // If end was less than start, reverse direction + tWipeXDist = -tWipeXDist; + tWipeXMove = -xMove; } - data[9] = a4 - a2; - if (data[9] < 0) + tWipeYDist = endY - startY; + if (tWipeYDist < 0) { - data[9] = -data[9]; - data[7] = -a6; + // If end was less than start, reverse direction + tWipeYDist = -tWipeYDist; + tWipeYMove = -yMove; } - data[10] = 0; + tWipeTemp = 0; } -static bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2) +static bool8 UpdateBlackWipe(s16 *data, bool8 xExact, bool8 yExact) { - u8 var; - if (data[8] > data[9]) + u8 numFinished; + + if (tWipeXDist > tWipeYDist) { - data[2] += data[6]; - data[10] += data[9]; - if (data[10] > data[8]) + // X has further to move, move it first + tWipeCurrX += tWipeXMove; + + // If it has been far enough since Y's + // last move then move it too + tWipeTemp += tWipeYDist; + if (tWipeTemp > tWipeXDist) { - data[3] += data[7]; - data[10] -= data[8]; + tWipeCurrY += tWipeYMove; + tWipeTemp -= tWipeXDist; } } else { - data[3] += data[7]; - data[10] += data[8]; - if (data[10] > data[9]) + // Y has further to move, move it first + tWipeCurrY += tWipeYMove; + + // If it has been far enough since X's + // last move then move it too + tWipeTemp += tWipeXDist; + if (tWipeTemp > tWipeYDist) { - data[2] += data[6]; - data[10] -= data[9]; + tWipeCurrX += tWipeXMove; + tWipeTemp -= tWipeYDist; } } - var = 0; - if ((data[6] > 0 && data[2] >= data[4]) || (data[6] < 0 && data[2] <= data[4])) + + numFinished = 0; + + // Has X coord reached end? + if ((tWipeXMove > 0 && tWipeCurrX >= tWipeEndX) + || (tWipeXMove < 0 && tWipeCurrX <= tWipeEndX)) { - var++; - if (a1) - data[2] = data[4]; + numFinished++; + if (xExact) + tWipeCurrX = tWipeEndX; } - if ((data[7] > 0 && data[3] >= data[5]) || (data[7] < 0 && data[3] <= data[5])) + + // Has Y coord reached end? + if ((tWipeYMove > 0 && tWipeCurrY >= tWipeEndY) + || (tWipeYMove < 0 && tWipeCurrY <= tWipeEndY)) { - var++; - if (a2) - data[3] = data[5]; + numFinished++; + if (yExact) + tWipeCurrY = tWipeEndY; } - if (var == 2) + // Return TRUE if both coords have reached end + if (numFinished == 2) return TRUE; else return FALSE; } -// sub-task for phase2 of a couple of new transitions -#define tData1 data[1] -#define tData2 data[2] -#define tData3 data[3] -#define tData4 data[4] -#define tData5 data[5] -#define tData6 data[6] -#define tData7 data[7] +//----------------------------------- +// B_TRANSITION_FRONTIER_LOGO_WIGGLE +//----------------------------------- + +#define tSinIndex data[4] +#define tAmplitude data[5] -static bool8 Phase2_FrontierLogoWiggle_Func1(struct Task *task) +static bool8 FrontierLogoWiggle_Init(struct Task *task) { u16 *tilemap, *tileset; - sub_814669C(task); + InitPatternWeaveTransition(task); GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sFrontierLogo_Tileset, tileset); - LoadPalette(sFrontierLogo_Palette, 0xF0, 0x20); + LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette)); task->tState++; return FALSE; } -static bool8 Phase2_FrontierLogoWiggle_Func2(struct Task *task) +static bool8 FrontierLogoWiggle_SetGfx(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap); - sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 0x84, task->tData5, 160); + SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT); task->tState++; return TRUE; } -static void Phase2Task_FrontierLogoWiggle(u8 taskId) +static void Task_FrontierLogoWiggle(u8 taskId) { - while (sPhase2_FrontierLogoWiggle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierLogoWiggle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_FrontierLogoWave(u8 taskId) +#undef tSinIndex +#undef tAmplitude + +//--------------------------------- +// B_TRANSITION_FRONTIER_LOGO_WAVE +//--------------------------------- + +#define tSinVal data[1] +#define tAmplitudeVal data[2] +#define tTimer data[3] +#define tStartedFade data[4] +#define tBlendTarget2 data[5] +#define tBlendTarget1 data[6] +#define tSinDecrement data[7] + +static void Task_FrontierLogoWave(u8 taskId) { - while (sPhase2_FrontierLogoWave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierLogoWave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_FrontierLogoWave_Func1(struct Task *task) +static bool8 FrontierLogoWave_Init(struct Task *task) { u16 *tilemap, *tileset; - InitTransitionStructVars(); + InitTransitionData(); ScanlineEffect_Clear(); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); - task->tData2 = 0x2000; - task->tData1 = 0x7FFF; - task->tData5 = 0; - task->tData6 = 16; - task->tData7 = 2560; - sTransitionStructPtr->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL; - sTransitionStructPtr->BLDALPHA = BLDALPHA_BLEND(task->tData5, task->tData6); - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; + task->tAmplitudeVal = 32 << 8; + task->tSinVal = 0x7FFF; + task->tBlendTarget2 = 0; + task->tBlendTarget1 = 16; + task->tSinDecrement = 2560; + sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL; + sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); + REG_BLDCNT = sTransitionData->BLDCNT; + REG_BLDALPHA = sTransitionData->BLDALPHA; GetBg0TilesDst(&tilemap, &tileset); - CpuFill16(0, tilemap, 0x800); + CpuFill16(0, tilemap, BG_SCREEN_SIZE); LZ77UnCompVram(sFrontierLogo_Tileset, tileset); - LoadPalette(sFrontierLogo_Palette, 0xF0, 0x20); - sTransitionStructPtr->field_16 = 0; + LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette)); + sTransitionData->cameraY = 0; task->tState++; return FALSE; } -static bool8 Phase2_FrontierLogoWave_Func2(struct Task *task) +static bool8 FrontierLogoWave_SetGfx(struct Task *task) { u16 *tilemap, *tileset; @@ -3918,164 +4322,190 @@ static bool8 Phase2_FrontierLogoWave_Func2(struct Task *task) return TRUE; } -static bool8 Phase2_FrontierLogoWave_Func3(struct Task *task) +static bool8 FrontierLogoWave_InitScanline(struct Task *task) { u8 i; - for (i = 0; i < 160; i++) - { - gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; - } + for (i = 0; i < DISPLAY_HEIGHT; i++) + gScanlineEffectRegBuffers[1][i] = sTransitionData->cameraY; - SetVBlankCallback(VBlankCB_Phase2_30); - SetHBlankCallback(HBlankCB_Phase2_30); + SetVBlankCallback(VBlankCB_FrontierLogoWave); + SetHBlankCallback(HBlankCB_FrontierLogoWave); EnableInterrupts(INTR_FLAG_HBLANK); task->tState++; return TRUE; } -static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task) +static bool8 FrontierLogoWave_Main(struct Task *task) { u8 i; - u16 var6, amplitude, var8; + u16 sinVal, amplitude, sinSpread; - sTransitionStructPtr->VBlank_DMA = FALSE; + sTransitionData->VBlank_DMA = FALSE; - amplitude = task->tData2 >> 8; - var6 = task->tData1; - var8 = 384; + amplitude = task->tAmplitudeVal >> 8; + sinVal = task->tSinVal; + sinSpread = 384; - task->tData1 = var6 - task->tData7; + task->tSinVal -= task->tSinDecrement; - if (task->tData3 >= 70) + if (task->tTimer >= 70) { - if (task->tData2 - 384 >= 0) - task->tData2 -= 384; + // Decrease amount of logo movement and distortion + // until it rests normally in the middle of the screen. + if (task->tAmplitudeVal - 384 >= 0) + task->tAmplitudeVal -= 384; else - task->tData2 = 0; + task->tAmplitudeVal = 0; } - if (task->tData3 >= 0 && task->tData3 % 3 == 0) + if (task->tTimer >= 0 && task->tTimer % 3 == 0) { - if (task->tData5 < 16) - task->tData5++; - else if (task->tData6 > 0) - task->tData6--; + // Blend logo into view + if (task->tBlendTarget2 < 16) + task->tBlendTarget2++; + else if (task->tBlendTarget1 > 0) + task->tBlendTarget1--; - sTransitionStructPtr->BLDALPHA = BLDALPHA_BLEND(task->tData5, task->tData6); + sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); } - for (i = 0; i < 160; i++, var6 += var8) + // Move logo up and down and distort it + for (i = 0; i < DISPLAY_HEIGHT; i++, sinVal += sinSpread) { - s16 index = var6 / 256; - gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index & 0xff, amplitude); + s16 index = sinVal / 256; + gScanlineEffectRegBuffers[0][i] = sTransitionData->cameraY + Sin(index & 0xff, amplitude); } - if (++task->tData3 == 101) + if (++task->tTimer == 101) { - task->tData4++; - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + task->tStartedFade++; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } - if (task->tData4 != 0 && !gPaletteFade.active) - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierLogoWave)); + if (task->tStartedFade && !gPaletteFade.active) + DestroyTask(FindTaskIdByFunc(Task_FrontierLogoWave)); - task->tData7 -= 17; - sTransitionStructPtr->VBlank_DMA++; + task->tSinDecrement -= 17; + sTransitionData->VBlank_DMA++; return FALSE; } -static void VBlankCB_Phase2_30(void) +static void VBlankCB_FrontierLogoWave(void) { VBlankCB_BattleTransition(); - REG_BLDCNT = sTransitionStructPtr->BLDCNT; - REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; + REG_BLDCNT = sTransitionData->BLDCNT; + REG_BLDALPHA = sTransitionData->BLDALPHA; - if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); + if (sTransitionData->VBlank_DMA) + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], DISPLAY_HEIGHT * 2); } -static void HBlankCB_Phase2_30(void) +static void HBlankCB_FrontierLogoWave(void) { u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG0VOFS = var; } -static void Phase2Task_FrontierSquares(u8 taskId) +#undef tSinVal +#undef tAmplitudeVal +#undef tTimer +#undef tStartedFade +#undef tBlendTarget2 +#undef tBlendTarget1 +#undef tSinDecrement + +//---------------------------------------------------------------------- +// B_TRANSITION_FRONTIER_SQUARES, B_TRANSITION_FRONTIER_SQUARES_SCROLL, +// and B_TRANSITION_FRONTIER_SQUARES_SPIRAL +//---------------------------------------------------------------------- + +#define tPosX data[2] +#define tPosY data[3] +#define tRowPos data[4] +#define tShrinkState data[5] +#define tShrinkDelayTimer data[6] +#define tShrinkDelay data[7] + +static void Task_FrontierSquares(u8 taskId) { - while (sPhase2_FrontierSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_FrontierSquaresSpiral(u8 taskId) +static void Task_FrontierSquaresSpiral(u8 taskId) { - while (sPhase2_FrontierSquaresSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierSquaresSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static void Phase2Task_FrontierSquaresScroll(u8 taskId) +static void Task_FrontierSquaresScroll(u8 taskId) { - while (sPhase2_FrontierSquaresScroll_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierSquaresScroll_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -static bool8 Phase2_FrontierSquares_Func1(struct Task *task) +static bool8 FrontierSquares_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); - FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF); - FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15); + FillBgTilemapBufferRect(0, 1, 30 - MARGIN_SIZE, 0, MARGIN_SIZE, 32, 15); CopyBgTilemapBufferToVram(0); - LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20); + LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette)); - task->tData2 = 1; - task->tData3 = 0; - task->tData4 = 0; - task->tData7 = 10; + task->tPosX = MARGIN_SIZE; + task->tPosY = 0; + task->tRowPos = 0; + task->tShrinkDelay = 10; task->tState++; return FALSE; } -static bool8 Phase2_FrontierSquares_Func2(struct Task *task) +static bool8 FrontierSquares_Draw(struct Task *task) { - CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, 4, 4, task->tData2, task->tData3, 4, 4, 0xF, 0, 0); + CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, + SQUARE_SIZE, SQUARE_SIZE, + task->tPosX, task->tPosY, + SQUARE_SIZE, SQUARE_SIZE, + 15, 0, 0); CopyBgTilemapBufferToVram(0); - task->tData2 += 4; - if (++task->tData4 == 7) + task->tPosX += SQUARE_SIZE; + if (++task->tRowPos == NUM_SQUARES_PER_ROW) { - task->tData2 = 1; - task->tData3 += 4; - task->tData4 = 0; - if (task->tData3 > 19) + task->tPosX = MARGIN_SIZE; + task->tPosY += SQUARE_SIZE; + task->tRowPos = 0; + if (task->tPosY >= NUM_SQUARES_PER_COL * SQUARE_SIZE) task->tState++; } return FALSE; } -static bool8 Phase2_FrontierSquares_Func3(struct Task *task) +static bool8 FrontierSquares_Shrink(struct Task *task) { u8 i; u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); - if (task->tData6++ >= task->tData7) + if (task->tShrinkDelayTimer++ >= task->tShrinkDelay) { - switch (task->tData5) + switch (task->tShrinkState) { case 0: for (i = 250; i < 255; i++) { - gPlttBufferUnfaded[i] = 0; - gPlttBufferFaded[i] = 0; + gPlttBufferUnfaded[i] = RGB_BLACK; + gPlttBufferFaded[i] = RGB_BLACK; } break; case 1: - BlendPalettes(PALETTES_ALL & ~(0x8000), 0x10, 0); + BlendPalettes(PALETTES_ALL & ~(1 << 15), 16, RGB_BLACK); LZ77UnCompVram(sFrontierSquares_EmptyBg_Tileset, tileset); break; case 2: @@ -4085,169 +4515,183 @@ static bool8 Phase2_FrontierSquares_Func3(struct Task *task) LZ77UnCompVram(sFrontierSquares_Shrink2_Tileset, tileset); break; default: - FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 32, 32); CopyBgTilemapBufferToVram(0); task->tState++; return FALSE; } - task->tData6 = 0; - task->tData5++; + task->tShrinkDelayTimer = 0; + task->tShrinkState++; } return FALSE; } -static bool8 Phase2_FrontierSquaresSpiral_Func1(struct Task *task) +#undef tPosX +#undef tPosY +#undef tRowPos +#undef tShrinkState +#undef tShrinkDelayTimer +#undef tShrinkDelay + +#define tSquareNum data[2] +#define tFadeFlag data[3] + +static bool8 FrontierSquaresSpiral_Init(struct Task *task) { u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); - FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF); - FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15); + FillBgTilemapBufferRect(0, 1, 30 - MARGIN_SIZE, 0, MARGIN_SIZE, 32, 15); CopyBgTilemapBufferToVram(0); - LoadPalette(sFrontierSquares_Palette, 0xE0, 0x20); - LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20); - BlendPalette(0xE0, 0x10, 8, 0); + LoadPalette(sFrontierSquares_Palette, 0xE0, sizeof(sFrontierSquares_Palette)); + LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette)); + BlendPalette(0xE0, 16, 8, RGB_BLACK); - task->tData2 = 34; - task->tData3 = 0; + task->tSquareNum = NUM_SQUARES - 1; + task->tFadeFlag = 0; task->tState++; return FALSE; } -static bool8 Phase2_FrontierSquaresSpiral_Func2(struct Task *task) +static bool8 FrontierSquaresSpiral_Outward(struct Task *task) { - u8 var = gUnknown_085C9A30[task->tData2]; - u8 varMod = var % 7; - u8 varDiv = var / 7; - CopyRectToBgTilemapBufferRect(0, &sFrontierSquares_Tilemap, 0, 0, 4, 4, 4 * varMod + 1, 4 * varDiv, 4, 4, 0xF, 0, 0); + u8 pos = sFrontierSquaresSpiral_Positions[task->tSquareNum]; + u8 x = pos % NUM_SQUARES_PER_ROW; + u8 y = pos / NUM_SQUARES_PER_ROW; + CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, + SQUARE_SIZE, SQUARE_SIZE, + SQUARE_SIZE * x + MARGIN_SIZE, SQUARE_SIZE * y, + SQUARE_SIZE, SQUARE_SIZE, + 15, 0, 0); CopyBgTilemapBufferToVram(0); - if (--task->tData2 < 0) + if (--task->tSquareNum < 0) task->tState++; return FALSE; } -static bool8 Phase2_FrontierSquaresSpiral_Func3(struct Task *task) +// Now that the overworld is completely covered by the squares, +// set it to black so it's not revealed when the squares are removed. +static bool8 FrontierSquaresSpiral_SetBlack(struct Task *task) { - BlendPalette(0xE0, 0x10, 3, 0); - BlendPalettes(PALETTES_ALL & ~(0x8000 | 0x4000), 0x10, 0); + BlendPalette(0xE0, 16, 3, RGB_BLACK); + BlendPalettes(PALETTES_ALL & ~(1 << 15 | 1 << 14), 16, RGB_BLACK); - task->tData2 = 0; - task->tData3 = 0; + task->tSquareNum = 0; + task->tFadeFlag = 0; task->tState++; return FALSE; } -static bool8 Phase2_FrontierSquaresSpiral_Func4(struct Task *task) +// Spiral inward erasing the squares +static bool8 FrontierSquaresSpiral_Inward(struct Task *task) { - if ((task->tData3 ^= 1)) + // Each square is faded first, then the one that was faded last move is erased. + if (task->tFadeFlag ^= 1) { - CopyRectToBgTilemapBufferRect( - 0, - sFrontierSquares_Tilemap, - 0, - 0, - 4, - 4, - 4 * (gUnknown_085C9A30[task->tData2] % 7) + 1, - 4 * (gUnknown_085C9A30[task->tData2] / 7), - 4, - 4, - 0xE, - 0, - 0); + // Shade square + CopyRectToBgTilemapBufferRect(0, sFrontierSquares_Tilemap, 0, 0, + SQUARE_SIZE, SQUARE_SIZE, + SQUARE_SIZE * (sFrontierSquaresSpiral_Positions[task->tSquareNum] % NUM_SQUARES_PER_ROW) + MARGIN_SIZE, + SQUARE_SIZE * (sFrontierSquaresSpiral_Positions[task->tSquareNum] / NUM_SQUARES_PER_ROW), + SQUARE_SIZE, SQUARE_SIZE, + 14, 0, 0); } else { - if (task->tData2 > 0) + if (task->tSquareNum > 0) { - FillBgTilemapBufferRect( - 0, - 1, - 4 * (gUnknown_085C9A30[task->tData2 - 1] % 7) + 1, - 4 * (gUnknown_085C9A30[task->tData2 - 1] / 7), - 4, - 4, - 0xF); + // Erase square + FillBgTilemapBufferRect(0, 1, + SQUARE_SIZE * (sFrontierSquaresSpiral_Positions[task->tSquareNum - 1] % NUM_SQUARES_PER_ROW) + MARGIN_SIZE, + SQUARE_SIZE * (sFrontierSquaresSpiral_Positions[task->tSquareNum - 1] / NUM_SQUARES_PER_ROW), + SQUARE_SIZE, SQUARE_SIZE, + 15); } - - task->tData2++; + task->tSquareNum++; } - if (task->tData2 > 34) + if (task->tSquareNum >= NUM_SQUARES) task->tState++; CopyBgTilemapBufferToVram(0); return FALSE; } -static bool8 Phase2_FrontierSquares_End(struct Task *task) +static bool8 FrontierSquares_End(struct Task *task) { - FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 32, 32); CopyBgTilemapBufferToVram(0); - BlendPalettes(PALETTES_ALL, 0x10, 0); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); DestroyTask(FindTaskIdByFunc(task->func)); return FALSE; } -// sub task for phase2 32 -#define tSub32_X_delta data[0] -#define tSub32_Y_delta data[1] -#define tSub32_Bool data[2] +#undef tSquareNum +#undef tFadeFlag + +#define tScrollXDir data[0] +#define tScrollYDir data[1] +#define tScrollUpdateFlag data[2] + +#define tSquareNum data[2] -static void sub_814ABE4(u8 taskId) +static void Task_ScrollBg(u8 taskId) { - if (!(gTasks[taskId].tSub32_Bool ^= 1)) + if (!(gTasks[taskId].tScrollUpdateFlag ^= 1)) { SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X); SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); - gBattle_BG0_X += gTasks[taskId].tSub32_X_delta; - gBattle_BG0_Y += gTasks[taskId].tSub32_Y_delta; + gBattle_BG0_X += gTasks[taskId].tScrollXDir; + gBattle_BG0_Y += gTasks[taskId].tScrollYDir; } } -static bool8 Phase2_FrontierSquaresScroll_Func1(struct Task *task) +static bool8 FrontierSquaresScroll_Init(struct Task *task) { u8 taskId = 0; u16 *tilemap, *tileset; GetBg0TilesDst(&tilemap, &tileset); LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); CopyBgTilemapBufferToVram(0); - LoadPalette(sFrontierSquares_Palette, 0xF0, 0x20); + LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette)); gBattle_BG0_X = 0; gBattle_BG0_Y = 0; SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X); SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); - task->tData2 = 0; - taskId = CreateTask(sub_814ABE4, 1); + task->tSquareNum = 0; + + // Start scrolling bg in a random direction. + taskId = CreateTask(Task_ScrollBg, 1); switch (Random() % 4) { - case 0: - gTasks[taskId].tSub32_X_delta = 1; - gTasks[taskId].tSub32_Y_delta = 1; + case 0: // Down/right + gTasks[taskId].tScrollXDir = 1; + gTasks[taskId].tScrollYDir = 1; break; - case 1: - gTasks[taskId].tSub32_X_delta = -1; - gTasks[taskId].tSub32_Y_delta = -1; + case 1: // Up/left + gTasks[taskId].tScrollXDir = -1; + gTasks[taskId].tScrollYDir = -1; break; - case 2: - gTasks[taskId].tSub32_X_delta = 1; - gTasks[taskId].tSub32_Y_delta = -1; + case 2: // Up/right + gTasks[taskId].tScrollXDir = 1; + gTasks[taskId].tScrollYDir = -1; break; - default: - gTasks[taskId].tSub32_X_delta = -1; - gTasks[taskId].tSub32_Y_delta = 1; + default: // Down/left + gTasks[taskId].tScrollXDir = -1; + gTasks[taskId].tScrollYDir = 1; break; } @@ -4255,75 +4699,67 @@ static bool8 Phase2_FrontierSquaresScroll_Func1(struct Task *task) return FALSE; } -static bool8 Phase2_FrontierSquaresScroll_Func2(struct Task *task) -{ - u8 var = gUnknown_085C9A53[task->tData2]; - u8 varDiv = var / 8; - u8 varAnd = var & 7; - - CopyRectToBgTilemapBufferRect( - 0, - &sFrontierSquares_Tilemap, - 0, - 0, - 4, - 4, - 4 * varDiv + 1, - 4 * varAnd, - 4, - 4, - 0xF, - 0, - 0); +static bool8 FrontierSquaresScroll_Draw(struct Task *task) +{ + u8 pos = sFrontierSquaresScroll_Positions[task->tSquareNum]; + u8 x = pos / (NUM_SQUARES_PER_ROW + 1); // +1 because during scroll an additional column covers the margin. + u8 y = pos % (NUM_SQUARES_PER_ROW + 1); + + CopyRectToBgTilemapBufferRect(0, &sFrontierSquares_Tilemap, 0, 0, + SQUARE_SIZE, SQUARE_SIZE, + SQUARE_SIZE * x + MARGIN_SIZE, SQUARE_SIZE * y, + SQUARE_SIZE, SQUARE_SIZE, + 15, 0, 0); CopyBgTilemapBufferToVram(0); - if (++task->tData2 > 63) + if (++task->tSquareNum >= (int)ARRAY_COUNT(sFrontierSquaresScroll_Positions)) task->tState++; return 0; } -static bool8 Phase2_FrontierSquaresScroll_Func3(struct Task *task) +// Now that the overworld is completely covered by the squares, +// set it to black so it's not revealed when the squares are removed. +static bool8 FrontierSquaresScroll_SetBlack(struct Task *task) { - BlendPalettes(PALETTES_ALL & ~(0x8000), 0x10, 0); + BlendPalettes(PALETTES_ALL & ~(1 << 15), 16, RGB_BLACK); - task->tData2 = 0; + task->tSquareNum = 0; task->tState++; return FALSE; } -static bool8 Phase2_FrontierSquaresScroll_Func4(struct Task *task) +static bool8 FrontierSquaresScroll_Erase(struct Task *task) { - u8 var = gUnknown_085C9A53[task->tData2]; - u8 varDiv = var / 8; - u8 varAnd = var & 7; + u8 pos = sFrontierSquaresScroll_Positions[task->tSquareNum]; + u8 x = pos / (NUM_SQUARES_PER_ROW + 1); + u8 y = pos % (NUM_SQUARES_PER_ROW + 1); - FillBgTilemapBufferRect(0, 1, 4 * varDiv + 1, 4 * varAnd, 4, 4, 0xF); + FillBgTilemapBufferRect(0, 1, + SQUARE_SIZE * x + MARGIN_SIZE, SQUARE_SIZE * y, + SQUARE_SIZE, SQUARE_SIZE, + 15); CopyBgTilemapBufferToVram(0); - if (++task->tData2 > 63) + if (++task->tSquareNum >= (int)ARRAY_COUNT(sFrontierSquaresScroll_Positions)) { - DestroyTask(FindTaskIdByFunc(sub_814ABE4)); + DestroyTask(FindTaskIdByFunc(Task_ScrollBg)); task->tState++; } return FALSE; } -#undef tSub32_X_delta -#undef tSub32_Y_delta -#undef tSub32_Bool - -static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task) +static bool8 FrontierSquaresScroll_End(struct Task *task) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; SetGpuReg(REG_OFFSET_BG0VOFS, 0); SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); - FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 32, 32); CopyBgTilemapBufferToVram(0); - BlendPalettes(PALETTES_ALL, 0x10, 0); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); DestroyTask(FindTaskIdByFunc(task->func)); @@ -4333,10 +4769,7 @@ static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task) return FALSE; } -#undef tData1 -#undef tData2 -#undef tData3 -#undef tData4 -#undef tData5 -#undef tData6 -#undef tData7 +#undef tScrollXDir +#undef tScrollYDir +#undef tScrollUpdateFlag +#undef tSquareNum diff --git a/src/battle_transition_frontier.c b/src/battle_transition_frontier.c index 2d34c9f86..e1cb03d8d 100644 --- a/src/battle_transition_frontier.c +++ b/src/battle_transition_frontier.c @@ -21,7 +21,6 @@ typedef bool8 (*TransitionStateFunc)(struct Task *task); -// this file's functions static void SpriteCB_LogoCircleSlide(struct Sprite *sprite); static void SpriteCB_LogoCircleSpiral(struct Sprite *sprite); static bool8 WaitForLogoCirclesAnim(struct Task *task); @@ -46,7 +45,6 @@ static bool8 CirclesSymmetricSpiralInSeq_End(struct Task *task); #define PALTAG_LOGO_CIRCLES 0x2E90 -// const rom data static const u32 sLogoCenter_Gfx[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_center.4bpp.lz"); static const u32 sLogoCenter_Tilemap[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_center.bin"); static const u32 sLogoCircles_Gfx[] = INCBIN_U32("graphics/battle_transitions/frontier_logo_circles.4bpp.lz"); @@ -121,7 +119,7 @@ static const struct SpriteTemplate sSpriteTemplate_LogoCircles = .callback = SpriteCallbackDummy, }; -static const TransitionStateFunc sPhase2_FrontierCirclesMeet_Funcs[] = +static const TransitionStateFunc sFrontierCirclesMeet_Funcs[] = { Circles_Init, CirclesMeet_CreateSprites, @@ -130,7 +128,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesMeet_Funcs[] = CirclesMeet_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesCross_Funcs[] = +static const TransitionStateFunc sFrontierCirclesCross_Funcs[] = { Circles_Init, CirclesCross_CreateSprites, @@ -139,7 +137,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesCross_Funcs[] = CirclesCross_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiral_Funcs[] = +static const TransitionStateFunc sFrontierCirclesAsymmetricSpiral_Funcs[] = { Circles_Init, CirclesAsymmetricSpiral_CreateSprites, @@ -148,7 +146,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiral_Funcs[] CirclesAsymmetricSpiral_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiral_Funcs[] = +static const TransitionStateFunc sFrontierCirclesSymmetricSpiral_Funcs[] = { Circles_Init, CirclesSymmetricSpiral_CreateSprites, @@ -157,7 +155,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiral_Funcs[] CirclesSymmetricSpiral_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesMeetInSeq_Funcs[] = +static const TransitionStateFunc sFrontierCirclesMeetInSeq_Funcs[] = { Circles_Init, CirclesMeetInSeq_CreateSprites, @@ -166,7 +164,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesMeetInSeq_Funcs[] = CirclesMeetInSeq_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesCrossInSeq_Funcs[] = +static const TransitionStateFunc sFrontierCirclesCrossInSeq_Funcs[] = { Circles_Init, CirclesCrossInSeq_CreateSprites, @@ -175,7 +173,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesCrossInSeq_Funcs[] = CirclesCrossInSeq_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiralInSeq_Funcs[] = +static const TransitionStateFunc sFrontierCirclesAsymmetricSpiralInSeq_Funcs[] = { Circles_Init, CirclesAsymmetricSpiralInSeq_CreateSprites, @@ -184,7 +182,7 @@ static const TransitionStateFunc sPhase2_FrontierCirclesAsymmetricSpiralInSeq_Fu CirclesAsymmetricSpiralInSeq_End }; -static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiralInSeq_Funcs[] = +static const TransitionStateFunc sFrontierCirclesSymmetricSpiralInSeq_Funcs[] = { Circles_Init, CirclesSymmetricSpiralInSeq_CreateSprites, @@ -193,45 +191,72 @@ static const TransitionStateFunc sPhase2_FrontierCirclesSymmetricSpiralInSeq_Fun CirclesSymmetricSpiralInSeq_End }; -// code +// Task data +#define tState data[0] +#define tTimer data[1] +#define tBlend data[2] +#define tFadeTimer data[3] +#define tCircle1SpriteId data[4] +#define tCircle2SpriteId data[5] +#define tCircle3SpriteId data[6] + +#define sTargetX data[0] +#define sTargetY data[1] + +// Sprite data for CreateSlidingLogoCircleSprite +#define sSpeedX data[2] +#define sSpeedY data[3] +#define sTimerX data[4] +#define sTimerY data[5] +#define sDelayX data[6] +#define sDelayY data[7] + +// Sprite data for CreateSpiralingLogoCircleSprite +#define sAngle data[2] +#define sRotateSpeed data[3] +#define sRadius data[4] +#define sTargetRadius data[5] +#define sRadiusDelta data[6] + + static void LoadLogoGfx(void) { - u16 *dst1, *dst2; + u16 *tilemap, *tileset; - GetBg0TilesDst(&dst1, &dst2); - LZ77UnCompVram(sLogoCenter_Gfx, dst2); - LZ77UnCompVram(sLogoCenter_Tilemap, dst1); - LoadPalette(sLogo_Pal, 0xF0, 0x20); + GetBg0TilesDst(&tilemap, &tileset); + LZ77UnCompVram(sLogoCenter_Gfx, tileset); + LZ77UnCompVram(sLogoCenter_Tilemap, tilemap); + LoadPalette(sLogo_Pal, 0xF0, sizeof(sLogo_Pal)); LoadCompressedSpriteSheet(&sSpriteSheet_LogoCircles); LoadSpritePalette(&sSpritePalette_LogoCircles); } -static u8 CreateSlidingLogoCircleSprite(s16 x, s16 y, u8 arg2, u8 arg3, s8 arg4, s8 arg5, u8 spriteAnimNum) +static u8 CreateSlidingLogoCircleSprite(s16 x, s16 y, u8 delayX, u8 delayY, s8 speedX, s8 speedY, u8 spriteAnimNum) { u8 spriteId = CreateSprite(&sSpriteTemplate_LogoCircles, x, y, 0); switch (spriteAnimNum) { case 0: - gSprites[spriteId].data[0] = 120; - gSprites[spriteId].data[1] = 45; + gSprites[spriteId].sTargetX = 120; + gSprites[spriteId].sTargetY = 45; break; case 1: - gSprites[spriteId].data[0] = 89; - gSprites[spriteId].data[1] = 97; + gSprites[spriteId].sTargetX = 89; + gSprites[spriteId].sTargetY = 97; break; case 2: - gSprites[spriteId].data[0] = 151; - gSprites[spriteId].data[1] = 97; + gSprites[spriteId].sTargetX = 151; + gSprites[spriteId].sTargetY = 97; break; } - gSprites[spriteId].data[2] = arg4; - gSprites[spriteId].data[3] = arg5; - gSprites[spriteId].data[6] = arg2; - gSprites[spriteId].data[7] = arg3; - gSprites[spriteId].data[4] = 0; - gSprites[spriteId].data[5] = 0; + gSprites[spriteId].sSpeedX = speedX; + gSprites[spriteId].sSpeedY = speedY; + gSprites[spriteId].sDelayX = delayX; + gSprites[spriteId].sDelayY = delayY; + gSprites[spriteId].sTimerX = 0; + gSprites[spriteId].sTimerY = 0; StartSpriteAnim(&gSprites[spriteId], spriteAnimNum); gSprites[spriteId].callback = SpriteCB_LogoCircleSlide; @@ -243,59 +268,60 @@ static void SpriteCB_LogoCircleSlide(struct Sprite *sprite) { s16 *data = sprite->data; - if (sprite->x == data[0] && sprite->y == data[1]) + if (sprite->x == sTargetX && sprite->y == sTargetY) { sprite->callback = SpriteCallbackDummy; } else { - if (data[4] == data[6]) + if (sTimerX == sDelayX) { - sprite->x += data[2]; - data[4] = 0; + sprite->x += sSpeedX; + sTimerX = 0; } else { - data[4]++; + sTimerX++; } - if (data[5] == data[7]) + if (sTimerY == sDelayY) { - sprite->y += data[3]; - data[5] = 0; + sprite->y += sSpeedY; + sTimerY = 0; } else { - data[5]++; + sTimerY++; } } } -static u8 CreateSpiralingLogoCircleSprite(s16 x, s16 y, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, u8 spriteAnimNum) +static u8 CreateSpiralingLogoCircleSprite(s16 x, s16 y, s16 angle, s16 rotateSpeed, s16 radiusStart, s16 radiusEnd, s16 radiusDelta, u8 spriteAnimNum) { u8 spriteId = CreateSprite(&sSpriteTemplate_LogoCircles, x, y, 0); + // Target coords are set but irrelevant switch (spriteAnimNum) { case 0: - gSprites[spriteId].data[0] = 120; - gSprites[spriteId].data[1] = 45; + gSprites[spriteId].sTargetX = 120; + gSprites[spriteId].sTargetY = 45; break; case 1: - gSprites[spriteId].data[0] = 89; - gSprites[spriteId].data[1] = 97; + gSprites[spriteId].sTargetX = 89; + gSprites[spriteId].sTargetY = 97; break; case 2: - gSprites[spriteId].data[0] = 151; - gSprites[spriteId].data[1] = 97; + gSprites[spriteId].sTargetX = 151; + gSprites[spriteId].sTargetY = 97; break; } - gSprites[spriteId].data[2] = arg2; - gSprites[spriteId].data[3] = arg3; - gSprites[spriteId].data[4] = arg4; - gSprites[spriteId].data[5] = arg5; - gSprites[spriteId].data[6] = arg6; + gSprites[spriteId].sAngle = angle; + gSprites[spriteId].sRotateSpeed = rotateSpeed; + gSprites[spriteId].sRadius = radiusStart; + gSprites[spriteId].sTargetRadius = radiusEnd; + gSprites[spriteId].sRadiusDelta = radiusDelta; StartSpriteAnim(&gSprites[spriteId], spriteAnimNum); gSprites[spriteId].callback = SpriteCB_LogoCircleSpiral; @@ -305,34 +331,32 @@ static u8 CreateSpiralingLogoCircleSprite(s16 x, s16 y, s16 arg2, s16 arg3, s16 static void SpriteCB_LogoCircleSpiral(struct Sprite *sprite) { - sprite->x2 = (Sin2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096 - sprite->y2 = (Cos2(sprite->data[2]) * sprite->data[4]) >> 12; // div by 4096 + sprite->x2 = (Sin2(sprite->sAngle) * sprite->sRadius) >> 12; // div by 4096 + sprite->y2 = (Cos2(sprite->sAngle) * sprite->sRadius) >> 12; // div by 4096 - sprite->data[2] = (sprite->data[2] + sprite->data[3]) % 360; + sprite->sAngle = (sprite->sAngle + sprite->sRotateSpeed) % 360; - if (sprite->data[4] != sprite->data[5]) - sprite->data[4] += sprite->data[6]; + if (sprite->sRadius != sprite->sTargetRadius) + sprite->sRadius += sprite->sRadiusDelta; else sprite->callback = SpriteCallbackDummy; } -#define tState data[0] - static void DestroyLogoCirclesGfx(struct Task *task) { FreeSpriteTilesByTag(PALTAG_LOGO_CIRCLES); FreeSpritePaletteByTag(PALTAG_LOGO_CIRCLES); - DestroySprite(&gSprites[task->data[4]]); - DestroySprite(&gSprites[task->data[5]]); - DestroySprite(&gSprites[task->data[6]]); + DestroySprite(&gSprites[task->tCircle1SpriteId]); + DestroySprite(&gSprites[task->tCircle2SpriteId]); + DestroySprite(&gSprites[task->tCircle3SpriteId]); } static bool8 IsLogoCirclesAnimFinished(struct Task *task) { - if (gSprites[task->data[4]].callback == SpriteCallbackDummy - && gSprites[task->data[5]].callback == SpriteCallbackDummy - && gSprites[task->data[6]].callback == SpriteCallbackDummy) + if (gSprites[task->tCircle1SpriteId].callback == SpriteCallbackDummy + && gSprites[task->tCircle2SpriteId].callback == SpriteCallbackDummy + && gSprites[task->tCircle3SpriteId].callback == SpriteCallbackDummy) return TRUE; else return FALSE; @@ -340,13 +364,13 @@ static bool8 IsLogoCirclesAnimFinished(struct Task *task) static bool8 Circles_Init(struct Task *task) { - if (task->data[1] == 0) + if (task->tTimer == 0) { ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON); - task->data[1]++; + task->tTimer++; return FALSE; } else @@ -358,7 +382,7 @@ static bool8 Circles_Init(struct Task *task) ChangeBgY(0, 0, 0); ChangeBgY(0, 0x500, 2); - task->data[1] = 0; + task->tTimer = 0; task->tState++; return TRUE; } @@ -366,27 +390,27 @@ static bool8 Circles_Init(struct Task *task) static bool8 FadeInCenterLogoCircle(struct Task *task) { - if (task->data[2] == 0) + if (task->tBlend == 0) SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON); - if (task->data[2] == 16) + if (task->tBlend == 16) { - if (task->data[3] == 31) + if (task->tFadeTimer == 31) { BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_BLACK); task->tState++; } else { - task->data[3]++; + task->tFadeTimer++; } } else { u16 blnd; - task->data[2]++; - blnd = task->data[2]; + task->tBlend++; + blnd = task->tBlend; SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(blnd, 16 - blnd)); } @@ -401,16 +425,16 @@ static bool8 WaitForLogoCirclesAnim(struct Task *task) return FALSE; } -void Phase2Task_FrontierCirclesMeet(u8 taskId) +void Task_FrontierCirclesMeet(u8 taskId) { - while (sPhase2_FrontierCirclesMeet_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesMeet_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesMeet_CreateSprites(struct Task *task) { - task->data[4] = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 2, 0); - task->data[5] = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 2, -2, 1); - task->data[6] = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -2, -2, 2); + task->tCircle1SpriteId = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 2, 0); + task->tCircle2SpriteId = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 2, -2, 1); + task->tCircle3SpriteId = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -2, -2, 2); task->tState++; return FALSE; @@ -421,22 +445,22 @@ static bool8 CirclesMeet_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesMeet)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesMeet)); } return FALSE; } -void Phase2Task_FrontierCirclesCross(u8 taskId) +void Task_FrontierCirclesCross(u8 taskId) { - while (sPhase2_FrontierCirclesCross_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesCross_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesCross_CreateSprites(struct Task *task) { - task->data[4] = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -4, 0); - task->data[5] = CreateSlidingLogoCircleSprite(241, 59, 0, 1, -4, 2, 1); - task->data[6] = CreateSlidingLogoCircleSprite(-1, 59, 0, 1, 4, 2, 2); + task->tCircle1SpriteId = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -4, 0); + task->tCircle2SpriteId = CreateSlidingLogoCircleSprite(241, 59, 0, 1, -4, 2, 1); + task->tCircle3SpriteId = CreateSlidingLogoCircleSprite(-1, 59, 0, 1, 4, 2, 2); task->tState++; return FALSE; @@ -447,22 +471,22 @@ static bool8 CirclesCross_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesCross)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesCross)); } return FALSE; } -void Phase2Task_FrontierCirclesAsymmetricSpiral(u8 taskId) +void Task_FrontierCirclesAsymmetricSpiral(u8 taskId) { - while (sPhase2_FrontierCirclesAsymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesAsymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesAsymmetricSpiral_CreateSprites(struct Task *task) { - task->data[4] = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0); - task->data[5] = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1); - task->data[6] = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2); + task->tCircle1SpriteId = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0); + task->tCircle2SpriteId = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1); + task->tCircle3SpriteId = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2); task->tState++; return FALSE; @@ -473,22 +497,22 @@ static bool8 CirclesAsymmetricSpiral_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesAsymmetricSpiral)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesAsymmetricSpiral)); } return FALSE; } -void Phase2Task_FrontierCirclesSymmetricSpiral(u8 taskId) +void Task_FrontierCirclesSymmetricSpiral(u8 taskId) { - while (sPhase2_FrontierCirclesSymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesSymmetricSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesSymmetricSpiral_CreateSprites(struct Task *task) { - task->data[4] = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0); - task->data[5] = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1); - task->data[6] = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2); + task->tCircle1SpriteId = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0); + task->tCircle2SpriteId = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1); + task->tCircle3SpriteId = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2); task->tState++; return FALSE; @@ -499,34 +523,34 @@ static bool8 CirclesSymmetricSpiral_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesSymmetricSpiral)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesSymmetricSpiral)); } return FALSE; } -void Phase2Task_FrontierCirclesMeetInSeq(u8 taskId) +void Task_FrontierCirclesMeetInSeq(u8 taskId) { - while (sPhase2_FrontierCirclesMeetInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesMeetInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesMeetInSeq_CreateSprites(struct Task *task) { - if (task->data[1] == 0) + if (task->tTimer == 0) { - task->data[4] = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 4, 0); + task->tCircle1SpriteId = CreateSlidingLogoCircleSprite(120, -51, 0, 0, 0, 4, 0); } - else if (task->data[1] == 16) + else if (task->tTimer == 16) { - task->data[5] = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 4, -4, 1); + task->tCircle2SpriteId = CreateSlidingLogoCircleSprite(-7, 193, 0, 0, 4, -4, 1); } - else if (task->data[1] == 32) + else if (task->tTimer == 32) { - task->data[6] = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -4, -4, 2); + task->tCircle3SpriteId = CreateSlidingLogoCircleSprite(247, 193, 0, 0, -4, -4, 2); task->tState++; } - task->data[1]++; + task->tTimer++; return FALSE; } @@ -535,34 +559,34 @@ static bool8 CirclesMeetInSeq_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesMeetInSeq)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesMeetInSeq)); } return FALSE; } -void Phase2Task_FrontierCirclesCrossInSeq(u8 taskId) +void Task_FrontierCirclesCrossInSeq(u8 taskId) { - while (sPhase2_FrontierCirclesCrossInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesCrossInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesCrossInSeq_CreateSprites(struct Task *task) { - if (task->data[1] == 0) + if (task->tTimer == 0) { - task->data[4] = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -8, 0); + task->tCircle1SpriteId = CreateSlidingLogoCircleSprite(120, 197, 0, 0, 0, -8, 0); } - else if (task->data[1] == 16) + else if (task->tTimer == 16) { - task->data[5] = CreateSlidingLogoCircleSprite(241, 78, 0, 0, -8, 1, 1); + task->tCircle2SpriteId = CreateSlidingLogoCircleSprite(241, 78, 0, 0, -8, 1, 1); } - else if (task->data[1] == 32) + else if (task->tTimer == 32) { - task->data[6] = CreateSlidingLogoCircleSprite(-1, 78, 0, 0, 8, 1, 2); + task->tCircle3SpriteId = CreateSlidingLogoCircleSprite(-1, 78, 0, 0, 8, 1, 2); task->tState++; } - task->data[1]++; + task->tTimer++; return FALSE; } @@ -571,34 +595,34 @@ static bool8 CirclesCrossInSeq_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesCrossInSeq)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesCrossInSeq)); } return FALSE; } -void Phase2Task_FrontierCirclesAsymmetricSpiralInSeq(u8 taskId) +void Task_FrontierCirclesAsymmetricSpiralInSeq(u8 taskId) { - while (sPhase2_FrontierCirclesAsymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesAsymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesAsymmetricSpiralInSeq_CreateSprites(struct Task *task) { - if (task->data[1] == 0) + if (task->tTimer == 0) { - task->data[4] = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0); + task->tCircle1SpriteId = CreateSpiralingLogoCircleSprite(120, 45, 12, 4, 128, 0, -4, 0); } - else if (task->data[1] == 16) + else if (task->tTimer == 16) { - task->data[5] = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1); + task->tCircle2SpriteId = CreateSpiralingLogoCircleSprite(89, 97, 252, 4, 128, 0, -4, 1); } - else if (task->data[1] == 32) + else if (task->tTimer == 32) { - task->data[6] = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2); + task->tCircle3SpriteId = CreateSpiralingLogoCircleSprite(151, 97, 132, 4, 128, 0, -4, 2); task->tState++; } - task->data[1]++; + task->tTimer++; return FALSE; } @@ -607,34 +631,34 @@ static bool8 CirclesAsymmetricSpiralInSeq_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesAsymmetricSpiralInSeq)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesAsymmetricSpiralInSeq)); } return FALSE; } -void Phase2Task_FrontierCirclesSymmetricSpiralInSeq(u8 taskId) +void Task_FrontierCirclesSymmetricSpiralInSeq(u8 taskId) { - while (sPhase2_FrontierCirclesSymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sFrontierCirclesSymmetricSpiralInSeq_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } static bool8 CirclesSymmetricSpiralInSeq_CreateSprites(struct Task *task) { - if (task->data[1] == 0) + if (task->tTimer == 0) { - task->data[4] = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0); + task->tCircle1SpriteId = CreateSpiralingLogoCircleSprite(120, 80, 284, 8, 131, 35, -3, 0); } - else if (task->data[1] == 16) + else if (task->tTimer == 16) { - task->data[5] = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1); + task->tCircle2SpriteId = CreateSpiralingLogoCircleSprite(120, 80, 44, 8, 131, 35, -3, 1); } - else if (task->data[1] == 32) + else if (task->tTimer == 32) { - task->data[6] = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2); + task->tCircle3SpriteId = CreateSpiralingLogoCircleSprite(121, 80, 164, 8, 131, 35, -3, 2); task->tState++; } - task->data[1]++; + task->tTimer++; return FALSE; } @@ -643,7 +667,7 @@ static bool8 CirclesSymmetricSpiralInSeq_End(struct Task *task) if (!gPaletteFade.active) { DestroyLogoCirclesGfx(task); - DestroyTask(FindTaskIdByFunc(Phase2Task_FrontierCirclesSymmetricSpiralInSeq)); + DestroyTask(FindTaskIdByFunc(Task_FrontierCirclesSymmetricSpiralInSeq)); } return FALSE; diff --git a/src/berry_blender.c b/src/berry_blender.c index 9701c8c81..65008dae0 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1608,7 +1608,7 @@ static void PrintPlayerNames(void) text[0] = EOS; StringCopy(text, gLinkPlayers[sBerryBlender->arrowIdToPlayerId[i]].name); - xPos = GetStringCenterAlignXOffset(1, text, 0x38); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, text, 0x38); if (playerId == sBerryBlender->arrowIdToPlayerId[i]) Blender_AddTextPrinter(i, text, xPos, 1, 0, 2); // Highlight player's name in red @@ -3494,7 +3494,7 @@ static bool8 PrintBlendingResults(void) u16 minutes, seconds; u8 *txtPtr; - xPos = GetStringCenterAlignXOffset(1, sText_BlendingResults, 0xA8); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sText_BlendingResults, 0xA8); Blender_AddTextPrinter(5, sText_BlendingResults, xPos, 1, TEXT_SPEED_FF, 0); if (sBerryBlender->numPlayers == BLENDER_MAX_PLAYERS) @@ -3526,7 +3526,7 @@ static bool8 PrintBlendingResults(void) StringAppend(sBerryBlender->stringVar, text); StringAppend(sBerryBlender->stringVar, sText_RPM); - xPos = GetStringRightAlignXOffset(1, sBerryBlender->stringVar, 0xA8); + xPos = GetStringRightAlignXOffset(FONT_NORMAL, sBerryBlender->stringVar, 0xA8); Blender_AddTextPrinter(5, sBerryBlender->stringVar, xPos, 0x51, TEXT_SPEED_FF, 3); Blender_AddTextPrinter(5, sText_Time, 0, 0x61, TEXT_SPEED_FF, 3); @@ -3539,7 +3539,7 @@ static bool8 PrintBlendingResults(void) ConvertIntToDecimalStringN(txtPtr, seconds, STR_CONV_MODE_LEADING_ZEROS, 2); StringAppend(sBerryBlender->stringVar, sText_Sec); - xPos = GetStringRightAlignXOffset(1, sBerryBlender->stringVar, 0xA8); + xPos = GetStringRightAlignXOffset(FONT_NORMAL, sBerryBlender->stringVar, 0xA8); Blender_AddTextPrinter(5, sBerryBlender->stringVar, xPos, 0x61, TEXT_SPEED_FF, 3); sBerryBlender->framesToWait = 0; @@ -3693,7 +3693,7 @@ static bool8 PrintBlendingRanking(void) break; case 3: DrawStdFrameWithCustomTileAndPalette(5, 0, 1, 0xD); - xPos = GetStringCenterAlignXOffset(1, sText_Ranking, 168); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sText_Ranking, 168); Blender_AddTextPrinter(5, sText_Ranking, xPos, 1, TEXT_SPEED_FF, 0); sBerryBlender->scoreIconIds[SCORE_BEST] = CreateSprite(&sSpriteTemplate_ScoreSymbols, 128, 52, 0); @@ -3767,9 +3767,9 @@ void ShowBerryBlenderRecordWindow(void) DrawStdWindowFrame(gRecordsWindowId, 0); FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1)); - xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 144); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_234Players, 4, 41, 0, NULL); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_BlenderMaxSpeedRecord, 144); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_234Players, 4, 41, 0, NULL); for (i = 0, yPos = 41; i < NUM_SCORE_TYPES; i++) { @@ -3783,8 +3783,8 @@ void ShowBerryBlenderRecordWindow(void) txtPtr = ConvertIntToDecimalStringN(txtPtr, record % 100, STR_CONV_MODE_LEADING_ZEROS, 2); txtPtr = StringAppend(txtPtr, sText_RPM); - xPos = GetStringRightAlignXOffset(1, text, 140); - AddTextPrinterParameterized(gRecordsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL); + xPos = GetStringRightAlignXOffset(FONT_NORMAL, text, 140); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, text, xPos, yPos + (i * 16), 0, NULL); } PutWindowTilemap(gRecordsWindowId); @@ -3879,7 +3879,7 @@ static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s3 FillWindowPixelBuffer(windowId, PIXEL_FILL(txtColor[0])); } - AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, 1, txtColor, speed, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, 1, txtColor, speed, string); } static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed) diff --git a/src/berry_crush.c b/src/berry_crush.c index dcd7363bd..8ac6bb312 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -1591,8 +1591,8 @@ static void FramesToMinSec(struct BerryCrushGame_Gfx *gfx, u16 frames) static void PrintTextCentered(u8 windowId, u8 left, u8 colorId, const u8 *string) { - left = (left * 4) - (GetStringWidth(2, string, -1) / 2u); - AddTextPrinterParameterized3(windowId, 2, left, 0, sTextColorTable[colorId], 0, string); + left = (left * 4) - (GetStringWidth(FONT_SHORT, string, -1) / 2u); + AddTextPrinterParameterized3(windowId, FONT_SHORT, left, 0, sTextColorTable[colorId], 0, string); } static void PrintResultsText(struct BerryCrushGame * game, u8 page, u8 sp14, u8 baseY) @@ -1652,8 +1652,8 @@ static void PrintResultsText(struct BerryCrushGame * game, u8 page, u8 sp14, u8 StringExpandPlaceholders(gStringVar4, sResultsTexts[page]); break; } - x = GetStringRightAlignXOffset(2, gStringVar4, sp14 - 4); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_SHORT, gStringVar4, sp14 - 4); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); if (playerId == game->localId) StringCopy(gStringVar3, gText_1DotBlueF700); else @@ -1661,7 +1661,7 @@ static void PrintResultsText(struct BerryCrushGame * game, u8 page, u8 sp14, u8 gStringVar3[0] = ranking + CHAR_1; DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, game->players[playerId].name); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gStringVar3); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, 4, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, 4, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); } } @@ -1676,34 +1676,34 @@ static void PrintCrushingResults(struct BerryCrushGame *game) FramesToMinSec(&game->gfx, results->time); // Print time text - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gText_TimeColon); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gText_TimeColon); // Print seconds text - x = 176 - (u8)GetStringWidth(2, gText_SpaceSec, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gText_SpaceSec); + x = 176 - (u8)GetStringWidth(FONT_SHORT, gText_SpaceSec, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gText_SpaceSec); // Print seconds value ConvertIntToDecimalStringN(gStringVar1, game->gfx.secondsInt, STR_CONV_MODE_LEADING_ZEROS, 2); ConvertIntToDecimalStringN(gStringVar2, game->gfx.secondsFrac, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_XDotY2); - x -= GetStringWidth(2, gStringVar4, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + x -= GetStringWidth(FONT_SHORT, gStringVar4, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); // Print minutes text - x -= GetStringWidth(2, gText_SpaceMin, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gText_SpaceMin); + x -= GetStringWidth(FONT_SHORT, gText_SpaceMin, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gText_SpaceMin); // Print minutes value ConvertIntToDecimalStringN(gStringVar1, game->gfx.minutes, STR_CONV_MODE_LEADING_ZEROS, 1); StringExpandPlaceholders(gStringVar4, gText_StrVar1); - x -= GetStringWidth(2, gStringVar4, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + x -= GetStringWidth(FONT_SHORT, gStringVar4, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); // Print pressing speed text y += 14; - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, 0, y, sTextColorTable[COLORID_GRAY], 0, gText_PressingSpeed); - x = 176 - (u8)GetStringWidth(2, gText_TimesPerSec, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gText_TimesPerSec); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, 0, y, sTextColorTable[COLORID_GRAY], 0, gText_PressingSpeed); + x = 176 - (u8)GetStringWidth(FONT_SHORT, gText_TimesPerSec, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gText_TimesPerSec); // Print pressing speed value for (i = 0; i < 8; i++) @@ -1712,21 +1712,21 @@ static void PrintCrushingResults(struct BerryCrushGame *game) ConvertIntToDecimalStringN(gStringVar1, game->pressingSpeed >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, pressingSpeedFrac / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_XDotY3); - x -= GetStringWidth(2, gStringVar4, -1); + x -= GetStringWidth(FONT_SHORT, gStringVar4, -1); if (game->newRecord) - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_RED], 0, gStringVar4); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_RED], 0, gStringVar4); else - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); // Print silkiness text y += 14; - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, 0, y, sTextColorTable[COLORID_GRAY], 0, gText_Silkiness); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, 0, y, sTextColorTable[COLORID_GRAY], 0, gText_Silkiness); // Print silkiness value ConvertIntToDecimalStringN(gStringVar1, results->silkiness, STR_CONV_MODE_RIGHT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_Var1Percent); - x = 176 - (u8)GetStringWidth(2, gStringVar4, -1); - AddTextPrinterParameterized3(game->gfx.resultsWindowId, 2, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + x = 176 - (u8)GetStringWidth(FONT_SHORT, gStringVar4, -1); + AddTextPrinterParameterized3(game->gfx.resultsWindowId, FONT_SHORT, x, y, sTextColorTable[COLORID_GRAY], 0, gStringVar4); } static bool32 OpenResultsWindow(struct BerryCrushGame *game, struct BerryCrushGame_Gfx *gfx) @@ -1814,10 +1814,10 @@ static void Task_ShowRankings(u8 taskId) break; case 1: // Print header text - xPos = 96 - GetStringWidth(1, gText_BerryCrush2, -1) / 2u; - AddTextPrinterParameterized3(tWindowId, 1, xPos, 1, sTextColorTable[COLORID_BLUE], 0, gText_BerryCrush2); - xPos = 96 - GetStringWidth(1, gText_PressingSpeedRankings, -1) / 2u; - AddTextPrinterParameterized3(tWindowId, 1, xPos, 17, sTextColorTable[COLORID_BLUE], 0, gText_PressingSpeedRankings); + xPos = 96 - GetStringWidth(FONT_NORMAL, gText_BerryCrush2, -1) / 2u; + AddTextPrinterParameterized3(tWindowId, FONT_NORMAL, xPos, 1, sTextColorTable[COLORID_BLUE], 0, gText_BerryCrush2); + xPos = 96 - GetStringWidth(FONT_NORMAL, gText_PressingSpeedRankings, -1) / 2u; + AddTextPrinterParameterized3(tWindowId, FONT_NORMAL, xPos, 17, sTextColorTable[COLORID_BLUE], 0, gText_PressingSpeedRankings); // Print pressing speed record for each group size, ranked yPos = 41; @@ -1825,9 +1825,9 @@ static void Task_ShowRankings(u8 taskId) { ConvertIntToDecimalStringN(gStringVar1, i + 2, STR_CONV_MODE_LEFT_ALIGN, 1); StringExpandPlaceholders(gStringVar4, gText_Var1Players); - AddTextPrinterParameterized3(tWindowId, 1, 0, yPos, sTextColorTable[COLORID_GRAY], 0, gStringVar4); - xPos = 192 - (u8)GetStringWidth(1, gText_TimesPerSec, -1); - AddTextPrinterParameterized3(tWindowId, 1, xPos, yPos, sTextColorTable[COLORID_GRAY], 0, gText_TimesPerSec); + AddTextPrinterParameterized3(tWindowId, FONT_NORMAL, 0, yPos, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + xPos = 192 - (u8)GetStringWidth(FONT_NORMAL, gText_TimesPerSec, -1); + AddTextPrinterParameterized3(tWindowId, FONT_NORMAL, xPos, yPos, sTextColorTable[COLORID_GRAY], 0, gText_TimesPerSec); for (j = 0; j < 8; j++) { if (((tPressingSpeeds(i) & 0xFF) >> (7 - j)) & 1) @@ -1836,8 +1836,8 @@ static void Task_ShowRankings(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, (u16)tPressingSpeeds(i) >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, score / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_XDotY3); - xPos -= GetStringWidth(1, gStringVar4, -1); - AddTextPrinterParameterized3(tWindowId, 1, xPos, yPos, sTextColorTable[COLORID_GRAY], 0, gStringVar4); + xPos -= GetStringWidth(FONT_NORMAL, gStringVar4, -1); + AddTextPrinterParameterized3(tWindowId, FONT_NORMAL, xPos, yPos, sTextColorTable[COLORID_GRAY], 0, gStringVar4); yPos += 16; score = 0; } @@ -1913,8 +1913,8 @@ static void DrawPlayerNameWindows(struct BerryCrushGame *game) // Print the player's name AddTextPrinterParameterized4( game->gfx.nameWindowIds[i], - 2, - 36 - GetStringWidth(2, game->players[i].name, 0) / 2u, + FONT_SHORT, + 36 - GetStringWidth(FONT_SHORT, game->players[i].name, 0) / 2u, 1, 0, 0, @@ -1928,8 +1928,8 @@ static void DrawPlayerNameWindows(struct BerryCrushGame *game) // Print a partner's name AddTextPrinterParameterized4( game->gfx.nameWindowIds[i], - 2, - 36 - GetStringWidth(2, game->players[i].name, 0) / 2u, + FONT_SHORT, + 36 - GetStringWidth(FONT_SHORT, game->players[i].name, 0) / 2u, 1, 0, 0, @@ -2258,11 +2258,11 @@ static u32 Cmd_PrintMessage(struct BerryCrushGame *game, u8 *args) if (args[1] & F_MSG_EXPAND) { StringExpandPlaceholders(gStringVar4, sMessages[args[0]]); - AddTextPrinterParameterized2(0, 1, gStringVar4, game->textSpeed, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, game->textSpeed, 0, 2, 1, 3); } else { - AddTextPrinterParameterized2(0, 1, sMessages[args[0]], game->textSpeed, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[args[0]], game->textSpeed, 0, 2, 1, 3); } CopyWindowToVram(0, 3); break; @@ -3242,7 +3242,7 @@ static u32 Cmd_SaveGame(struct BerryCrushGame *game, u8 *args) if (!IsLinkTaskFinished()) return 0; DrawDialogueFrame(0, 0); - AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3); CopyWindowToVram(0, 3); CreateTask(Task_LinkSave, 0); break; @@ -3391,9 +3391,9 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args) case 0: DrawDialogueFrame(0, 0); if (game->playAgainState == PLAY_AGAIN_NO_BERRIES) - AddTextPrinterParameterized2(0, 1, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3); else - AddTextPrinterParameterized2(0, 1, sMessages[MSG_DROPPED], game->textSpeed, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_DROPPED], game->textSpeed, 0, 2, 1, 3); CopyWindowToVram(0, 3); break; case 1: diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index dc025c0a4..9b0da5bd2 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -303,21 +303,21 @@ static void BerryFix_GpuSet(void) FillWindowPixelBuffer(3, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(10)); - width = GetStringWidth(0, sText_Emerald, 0); + width = GetStringWidth(FONT_SMALL, sText_Emerald, 0); left = (120 - width) / 2; - AddTextPrinterParameterized3(2, 0, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_Emerald); + AddTextPrinterParameterized3(2, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_Emerald); - width = GetStringWidth(0, sText_RubySapphire, 0); + width = GetStringWidth(FONT_SMALL, sText_RubySapphire, 0); left = (120 - width) / 2 + 120; - AddTextPrinterParameterized3(2, 0, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); + AddTextPrinterParameterized3(2, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); - width = GetStringWidth(0, sText_RubySapphire, 0); + width = GetStringWidth(FONT_SMALL, sText_RubySapphire, 0); left = (112 - width) / 2; - AddTextPrinterParameterized3(3, 0, left, 0, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); + AddTextPrinterParameterized3(3, FONT_SMALL, left, 0, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); - width = GetStringWidth(1, sText_BerryProgramUpdate, 0); + width = GetStringWidth(FONT_NORMAL, sText_BerryProgramUpdate, 0); left = (208 - width) / 2; - AddTextPrinterParameterized3(0, 1, left, 2, sBerryProgramTextColors, TEXT_SPEED_FF, sText_BerryProgramUpdate); + AddTextPrinterParameterized3(0, FONT_NORMAL, left, 2, sBerryProgramTextColors, TEXT_SPEED_FF, sText_BerryProgramUpdate); CopyWindowToVram(2, 2); CopyWindowToVram(3, 2); @@ -346,7 +346,7 @@ static void BerryFix_SetScene(int scene) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); FillWindowPixelBuffer(1, PIXEL_FILL(10)); - AddTextPrinterParameterized3(1, 1, 0, 0, sBerryProgramTextColors, -1, sBerryProgramTexts[scene]); + AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 0, sBerryProgramTextColors, -1, sBerryProgramTexts[scene]); PutWindowTilemap(1); CopyWindowToVram(1, 2); switch (scene) diff --git a/src/berry_powder.c b/src/berry_powder.c index f77265412..d933dbff1 100755 --- a/src/berry_powder.c +++ b/src/berry_powder.c @@ -205,13 +205,13 @@ u32 GetBerryPowder(void) static void PrintBerryPowderAmount(u8 windowId, int amount, u8 x, u8 y, u8 speed) { ConvertIntToDecimalStringN(gStringVar1, amount, STR_CONV_MODE_RIGHT_ALIGN, 5); - AddTextPrinterParameterized(windowId, 1, gStringVar1, x, y, speed, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar1, x, y, speed, NULL); } static void DrawPlayerPowderAmount(u8 windowId, u16 baseTileOffset, u8 paletteNum, u32 amount) { DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, baseTileOffset, paletteNum); - AddTextPrinterParameterized(windowId, 1, gText_Powder, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_Powder, 0, 1, TEXT_SPEED_FF, NULL); PrintBerryPowderAmount(windowId, amount, 26, 17, 0); } diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 5a6f6f694..21070cb94 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -376,14 +376,14 @@ static void HandleInitWindows(void) static void PrintTextInBerryTagScreen(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed, u8 colorStructId) { - AddTextPrinterParameterized4(windowId, 1, x, y, 0, 0, sTextColors[colorStructId], speed, text); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, 0, sTextColors[colorStructId], speed, text); } static void AddBerryTagTextToBg0(void) { memcpy(GetBgTilemapBuffer(0), sBerryTag->tilemapBuffers[2], sizeof(sBerryTag->tilemapBuffers[2])); FillWindowPixelBuffer(WIN_BERRY_TAG, PIXEL_FILL(15)); - PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(1, gText_BerryTag, 0x40), 1, 0, 1); + PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(FONT_NORMAL, gText_BerryTag, 0x40), 1, 0, 1); PutWindowTilemap(WIN_BERRY_TAG); ScheduleBgCopyTilemapToVram(0); } @@ -409,7 +409,7 @@ static void PrintBerryNumberAndName(void) static void PrintBerrySize(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gText_SizeSlash, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_SizeSlash, 0, 1, TEXT_SPEED_FF, NULL); if (berry->size != 0) { u32 inches, fraction; @@ -423,34 +423,34 @@ static void PrintBerrySize(void) ConvertIntToDecimalStringN(gStringVar1, inches, STR_CONV_MODE_LEFT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar2, fraction, STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_Var1DotVar2); - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gStringVar4, 0x28, 1, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gStringVar4, 0x28, 1, 0, NULL); } else { - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gText_ThreeMarks, 0x28, 1, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_ThreeMarks, 0x28, 1, 0, NULL); } } static void PrintBerryFirmness(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gText_FirmSlash, 0, 0x11, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_FirmSlash, 0, 0x11, TEXT_SPEED_FF, NULL); if (berry->firmness != 0) - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, sBerryFirmnessStrings[berry->firmness - 1], 0x28, 0x11, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, sBerryFirmnessStrings[berry->firmness - 1], 0x28, 0x11, 0, NULL); else - AddTextPrinterParameterized(WIN_SIZE_FIRM, 1, gText_ThreeMarks, 0x28, 0x11, 0, NULL); + AddTextPrinterParameterized(WIN_SIZE_FIRM, FONT_NORMAL, gText_ThreeMarks, 0x28, 0x11, 0, NULL); } static void PrintBerryDescription1(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_DESC, 1, berry->description1, 0, 1, 0, NULL); + AddTextPrinterParameterized(WIN_DESC, FONT_NORMAL, berry->description1, 0, 1, 0, NULL); } static void PrintBerryDescription2(void) { const struct Berry *berry = GetBerryInfo(sBerryTag->berryId); - AddTextPrinterParameterized(WIN_DESC, 1, berry->description2, 0, 0x11, 0, NULL); + AddTextPrinterParameterized(WIN_DESC, FONT_NORMAL, berry->description2, 0, 0x11, 0, NULL); } static void CreateBerrySprite(void) diff --git a/src/unk_text_util_2.c b/src/braille.c index a0eea575e..4e22a12ef 100644 --- a/src/unk_text_util_2.c +++ b/src/braille.c @@ -4,13 +4,16 @@ #include "text.h" #include "sound.h" +// This file handles the braille font. +// For printing braille messages, see ScrCmd_braillemessage + ALIGNED(4) static const u8 sScrollDistances[] = {1, 2, 4}; -static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont"); +static const u16 sFont_Braille[] = INCBIN_U16("graphics/fonts/braille.fwjpnfont"); -static void DecompressGlyphFont6(u16); +static void DecompressGlyph_Braille(u16); -u16 Font6Func(struct TextPrinter *textPrinter) +u16 FontFunc_Braille(struct TextPrinter *textPrinter) { u16 char_; struct TextPrinterSubStruct *subStruct; @@ -81,7 +84,7 @@ u16 Font6Func(struct TextPrinter *textPrinter) textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_FONT: - subStruct->glyphId = *textPrinter->printerTemplate.currentChar; + subStruct->fontId = *textPrinter->printerTemplate.currentChar; textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_RESET_SIZE: @@ -133,7 +136,7 @@ u16 Font6Func(struct TextPrinter *textPrinter) textPrinter->printerTemplate.currentChar++; return 0; } - DecompressGlyphFont6(char_); + DecompressGlyph_Braille(char_); CopyGlyphToWindow(textPrinter); textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing; return 0; @@ -201,20 +204,18 @@ u16 Font6Func(struct TextPrinter *textPrinter) return 1; } -static void DecompressGlyphFont6(u16 glyph) +static void DecompressGlyph_Braille(u16 glyph) { - const u16 *glyphs; - - glyphs = sFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8); + const u16 *glyphs = sFont_Braille + 0x100 * (glyph / 8) + 0x10 * (glyph % 8); DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop); DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8); DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); DecompressGlyphTile(glyphs + 0x88, gCurGlyph.gfxBufferBottom + 8); - gCurGlyph.width = 0x10; - gCurGlyph.height = 0x10; + gCurGlyph.width = 16; + gCurGlyph.height = 16; } -u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese) +u32 GetGlyphWidth_Braille(u16 glyphId, bool32 isJapanese) { - return 0x10; + return 16; } diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index d8410988d..61fab39e2 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -13,16 +13,9 @@ #include "party_menu.h" #include "fldeff.h" -// why do this, GF? -enum -{ - REGIROCK_PUZZLE, - REGISTEEL_PUZZLE -}; - -EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; +EWRAM_DATA static bool8 sIsRegisteelPuzzle = 0; -static const u8 gRegicePathCoords[][2] = +static const u8 sRegicePathCoords[][2] = { {4, 21}, {5, 21}, @@ -62,9 +55,9 @@ static const u8 gRegicePathCoords[][2] = {4, 22}, }; -void SealedChamberShakingEffect(u8); -void DoBrailleRegirockEffect(void); -void DoBrailleRegisteelEffect(void); +static void Task_SealedChamberShakingEffect(u8); +static void DoBrailleRegirockEffect(void); +static void DoBrailleRegisteelEffect(void); bool8 ShouldDoBrailleDigEffect(void) { @@ -116,43 +109,48 @@ void ShouldDoBrailleRegirockEffectOld(void) { } -void DoSealedChamberShakingEffect1(void) +#define tDelayCounter data[1] +#define tShakeCounter data[2] +#define tVerticalPan data[4] +#define tDelay data[5] +#define tNumShakes data[6] + +void DoSealedChamberShakingEffect_Long(void) { - u8 taskId = CreateTask(SealedChamberShakingEffect, 9); + u8 taskId = CreateTask(Task_SealedChamberShakingEffect, 9); - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[2] = 0; - gTasks[taskId].data[4] = 2; - gTasks[taskId].data[5] = 5; - gTasks[taskId].data[6] = 50; + gTasks[taskId].tDelayCounter = 0; + gTasks[taskId].tShakeCounter = 0; + gTasks[taskId].tVerticalPan = 2; + gTasks[taskId].tDelay = 5; + gTasks[taskId].tNumShakes = 50; SetCameraPanningCallback(0); } -void DoSealedChamberShakingEffect2(void) +void DoSealedChamberShakingEffect_Short(void) { - u8 taskId = CreateTask(SealedChamberShakingEffect, 9); + u8 taskId = CreateTask(Task_SealedChamberShakingEffect, 9); - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[2] = 0; - gTasks[taskId].data[4] = 3; - gTasks[taskId].data[5] = 5; - gTasks[taskId].data[6] = 2; + gTasks[taskId].tDelayCounter = 0; + gTasks[taskId].tShakeCounter = 0; + gTasks[taskId].tVerticalPan = 3; + gTasks[taskId].tDelay = 5; + gTasks[taskId].tNumShakes = 2; SetCameraPanningCallback(0); } -void SealedChamberShakingEffect(u8 taskId) +static void Task_SealedChamberShakingEffect(u8 taskId) { struct Task *task = &gTasks[taskId]; - task->data[1]++; - - if (!(task->data[1] % task->data[5])) + task->tDelayCounter++; + if (task->tDelayCounter % task->tDelay == 0) { - task->data[1] = 0; - task->data[2]++; - task->data[4] = -task->data[4]; - SetCameraPanning(0, task->data[4]); - if (task->data[2] == task->data[6]) + task->tDelayCounter = 0; + task->tShakeCounter++; + task->tVerticalPan = -task->tVerticalPan; + SetCameraPanning(0, task->tVerticalPan); + if (task->tShakeCounter == task->tNumShakes) { DestroyTask(taskId); EnableBothScriptContexts(); @@ -161,7 +159,12 @@ void SealedChamberShakingEffect(u8 taskId) } } -// moved later in the function because it was rewritten. +#undef tDelayCounter +#undef tShakeCounter +#undef tVerticalPan +#undef tDelay +#undef tNumShakes + bool8 ShouldDoBrailleRegirockEffect(void) { if (!FlagGet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED) @@ -170,17 +173,17 @@ bool8 ShouldDoBrailleRegirockEffect(void) { if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; + sIsRegisteelPuzzle = FALSE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; + sIsRegisteelPuzzle = FALSE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; + sIsRegisteelPuzzle = FALSE; return TRUE; } } @@ -200,7 +203,7 @@ void UseRegirockHm_Callback(void) DoBrailleRegirockEffect(); } -void DoBrailleRegirockEffect(void) +static void DoBrailleRegirockEffect(void) { MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid); @@ -220,7 +223,7 @@ bool8 ShouldDoBrailleRegisteelEffect(void) { if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 25) { - sBraillePuzzleCallbackFlag = REGISTEEL_PUZZLE; + sIsRegisteelPuzzle = TRUE; return TRUE; } } @@ -239,7 +242,7 @@ void UseRegisteelHm_Callback(void) DoBrailleRegisteelEffect(); } -void DoBrailleRegisteelEffect(void) +static void DoBrailleRegisteelEffect(void) { MapGridSetMetatileIdAt(7 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopLeft); MapGridSetMetatileIdAt(8 + MAP_OFFSET, 19 + MAP_OFFSET, METATILE_Cave_SealedChamberEntrance_TopMid); @@ -254,7 +257,7 @@ void DoBrailleRegisteelEffect(void) } // theory: another commented out DoBrailleWait and Task_BrailleWait. -void DoBrailleWait(void) +static void DoBrailleWait(void) { } @@ -263,7 +266,7 @@ bool8 FldEff_UsePuzzleEffect(void) { u8 taskId = CreateFieldMoveTask(); - if (sBraillePuzzleCallbackFlag == REGISTEEL_PUZZLE) + if (sIsRegisteelPuzzle == TRUE) { gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16; gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; @@ -290,10 +293,10 @@ bool8 ShouldDoBrailleRegicePuzzle(void) if (FlagGet(FLAG_TEMP_3) == TRUE) return FALSE; - for (i = 0; i < 36; i++) + for (i = 0; i < ARRAY_COUNT(sRegicePathCoords); i++) { - u8 xPos = gRegicePathCoords[i][0]; - u8 yPos = gRegicePathCoords[i][1]; + u8 xPos = sRegicePathCoords[i][0]; + u8 yPos = sRegicePathCoords[i][1]; if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) { u16 varValue; diff --git a/src/cable_club.c b/src/cable_club.c index 3083ed9c0..1284aee77 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -99,8 +99,8 @@ static void PrintNumPlayersInLink(u16 windowId, u32 numPlayers) ConvertIntToDecimalStringN(gStringVar1, numPlayers, STR_CONV_MODE_LEFT_ALIGN, 1); SetStandardWindowBorderStyle(windowId, 0); StringExpandPlaceholders(gStringVar4, gText_NumPlayerLink); - xPos = GetStringCenterAlignXOffset(1, gStringVar4, 88); - AddTextPrinterParameterized(windowId, 1, gStringVar4, xPos, 1, 0xFF, NULL); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 88); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, xPos, 1, 0xFF, NULL); CopyWindowToVram(windowId, 3); } diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index 187fd0ffe..9bde45e97 100644 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -80,7 +80,7 @@ void CB2_InitClearSaveDataScreen(void) static void Task_DoClearSaveDataScreenYesNo(u8 taskId) { DrawStdFrameWithCustomTileAndPalette(0, 0, 2, 14); - AddTextPrinterParameterized(0, 1, gText_ClearAllSaveData, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_ClearAllSaveData, 0, 1, 0, 0); CreateYesNoMenu(sClearSaveYesNo, 2, 14, 1); gTasks[taskId].func = Task_ClearSaveDataScreenYesNoChoice; } @@ -91,7 +91,7 @@ static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId) { case 0: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized(0, 1, gText_ClearingData, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_ClearingData, 0, 1, 0, 0); gTasks[taskId].func = Task_ClearSaveData; break; case 1: diff --git a/src/coins.c b/src/coins.c index 52c7dd3ec..17fd147b7 100644 --- a/src/coins.c +++ b/src/coins.c @@ -17,8 +17,8 @@ void PrintCoinsString(u32 coinAmount) ConvertIntToDecimalStringN(gStringVar1, coinAmount, STR_CONV_MODE_RIGHT_ALIGN, MAX_COIN_DIGITS); StringExpandPlaceholders(gStringVar4, gText_Coins); - xAlign = GetStringRightAlignXOffset(1, gStringVar4, 0x40); - AddTextPrinterParameterized(sCoinsWindowId, 1, gStringVar4, xAlign, 1, 0, NULL); + xAlign = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x40); + AddTextPrinterParameterized(sCoinsWindowId, FONT_NORMAL, gStringVar4, xAlign, 1, 0, NULL); } void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y) diff --git a/src/contest.c b/src/contest.c index 336e62286..1cd8f18b0 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1543,7 +1543,7 @@ static void Task_ShowMoveSelectScreen(u8 taskId) moveNameBuffer = StringCopy(moveNameBuffer, gMoveNames[move]); FillWindowPixelBuffer(i + MOVE_WINDOWS_START, PIXEL_FILL(0)); - Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, 7); + Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, FONT_NARROW); } DrawMoveSelectArrow(eContest.playerMoveChoice); @@ -3029,10 +3029,10 @@ static void PrintContestantTrainerNameWithColor(u8 contestant, u8 color) StringCopy(buffer, gText_Slash); StringAppend(buffer, gContestMons[contestant].trainerName); Contest_CopyStringWithColor(buffer, color); - offset = GetStringRightAlignXOffset(7, gDisplayedStringBattle, 0x60); + offset = GetStringRightAlignXOffset(FONT_NARROW, gDisplayedStringBattle, 0x60); if (offset > 55) offset = 55; - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, offset, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, offset, 1, FONT_NARROW); } static void PrintContestantMonName(u8 contestant) @@ -3043,7 +3043,7 @@ static void PrintContestantMonName(u8 contestant) static void PrintContestantMonNameWithColor(u8 contestant, u8 color) { Contest_CopyStringWithColor(gContestMons[contestant].nickname, color); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, FONT_NARROW); } static u16 CalculateContestantRound1Points(u8 who, u8 contestCategory) @@ -4273,7 +4273,7 @@ static void ContestDebugDoPrint(void) txtPtr = StringCopy(txtPtr, gText_OneDash); } ConvertIntToDecimalStringN(txtPtr, value, STR_CONV_MODE_LEFT_ALIGN, 4); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text, 55, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text, 55, 1, FONT_NARROW); } for (i = 0; i < CONTESTANT_COUNT; i++) { @@ -4285,7 +4285,7 @@ static void ContestDebugDoPrint(void) txtPtr = StringCopy(txtPtr, gText_OneDash); } ConvertIntToDecimalStringN(txtPtr, value, STR_CONV_MODE_LEFT_ALIGN, 4); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text, 5, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text, 5, 1, FONT_NARROW); } SwapMoveDescAndContestTilemaps(); break; @@ -5410,7 +5410,7 @@ static void Contest_PrintTextToBg0WindowStd(u32 windowId, const u8 *b) printerTemplate.currentChar = b; printerTemplate.windowId = windowId; - printerTemplate.fontId = 1; + printerTemplate.fontId = FONT_NORMAL; printerTemplate.x = 0; printerTemplate.y = 1; printerTemplate.currentX = 0; @@ -5457,7 +5457,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b) printerTemplate.currentChar = currChar; printerTemplate.windowId = 4; - printerTemplate.fontId = 1; + printerTemplate.fontId = FONT_NORMAL; printerTemplate.x = 0; printerTemplate.y = 1; printerTemplate.currentX = 0; @@ -5968,7 +5968,7 @@ static void ContestDebugPrintBitStrings(void) for (i = 0; i < CONTESTANT_COUNT; i++) { txtPtr = StringCopy(text1, gText_CDot); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1, 5, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1, 5, 1, FONT_NARROW); bits = gContestResources->tv[i].winnerFlags; for (j = 7; j > -1; j--) // Weird loop. { @@ -5981,7 +5981,7 @@ static void ContestDebugPrintBitStrings(void) text2[j] = EOS; Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text2, 5, 1, 7); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1 + j, 55, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1 + j, 55, 1, FONT_NARROW); } } else // CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS @@ -6001,8 +6001,8 @@ static void ContestDebugPrintBitStrings(void) text2[j] = text1[j]; text2[j] = EOS; - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text2, 5, 1, 7); - Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1 + j, 55, 1, 7); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text2, 5, 1, FONT_NARROW); + Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1 + j, 55, 1, FONT_NARROW); } } SwapMoveDescAndContestTilemaps(); @@ -6031,10 +6031,10 @@ static u8 GetMonNicknameLanguage(u8 *nickname) || *nickname == CHAR_SLASH || *nickname == CHAR_HYPHEN || *nickname == CHAR_ELLIPSIS - || *nickname == CHAR_DBL_QUOT_LEFT - || *nickname == CHAR_DBL_QUOT_RIGHT - || *nickname == CHAR_SGL_QUOT_LEFT - || *nickname == CHAR_DBL_QUOT_LEFT) // Most likely a typo, CHAR_SGL_QUOT_RIGHT should be here instead. + || *nickname == CHAR_DBL_QUOTE_LEFT + || *nickname == CHAR_DBL_QUOTE_RIGHT + || *nickname == CHAR_SGL_QUOTE_LEFT + || *nickname == CHAR_DBL_QUOTE_LEFT) // Most likely a typo, CHAR_SGL_QUOTE_RIGHT should be here instead. { nickname++; } diff --git a/src/contest_painting.c b/src/contest_painting.c index c591fc9ef..db6bf4455 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -306,8 +306,8 @@ static void PrintContestPaintingCaption(u8 contestType, bool8 isForArtist) StringExpandPlaceholders(gStringVar4, sMuseumCaptions[category]); } - x = GetStringCenterAlignXOffset(1, gStringVar4, 208); - AddTextPrinterParameterized(sWindowId, 1, gStringVar4, x, 1, 0, 0); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 208); + AddTextPrinterParameterized(sWindowId, FONT_NORMAL, gStringVar4, x, 1, 0, 0); CopyBgTilemapBufferToVram(1); } diff --git a/src/contest_util.c b/src/contest_util.c index d3e1a600e..e1c95d4a2 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -1176,12 +1176,12 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) windowId = AddWindow(&windowTemplate); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - origWidth = GetStringWidth(1, text, 0); + origWidth = GetStringWidth(FONT_NORMAL, text, 0); strWidth = (origWidth + 9) / 8; if (strWidth > 30) strWidth = 30; - AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, -1, text); + AddTextPrinterParameterized3(windowId, FONT_NORMAL, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, -1, text); { s32 i; struct Sprite *sprite; @@ -1931,7 +1931,7 @@ static void AddContestTextPrinter(int windowId, u8 *str, int x) struct TextPrinterTemplate textPrinter; textPrinter.currentChar = str; textPrinter.windowId = windowId; - textPrinter.fontId = 7; + textPrinter.fontId = FONT_NARROW; textPrinter.x = x; textPrinter.y = 2; textPrinter.currentX = x; diff --git a/src/credits.c b/src/credits.c index 519cfe39e..de7597e32 100644 --- a/src/credits.c +++ b/src/credits.c @@ -400,8 +400,8 @@ static void PrintCreditsText(const u8 *string, u8 y, bool8 isTitle) color[2] = TEXT_COLOR_DARK_GRAY; } - x = GetStringCenterAlignXOffsetWithLetterSpacing(1, string, DISPLAY_WIDTH, 1); - AddTextPrinterParameterized4(0, 1, x, y, 1, 0, color, -1, string); + x = GetStringCenterAlignXOffsetWithLetterSpacing(FONT_NORMAL, string, DISPLAY_WIDTH, 1); + AddTextPrinterParameterized4(0, FONT_NORMAL, x, y, 1, 0, color, -1, string); } #define tMainTaskId data[1] diff --git a/src/daycare.c b/src/daycare.c index 8105c2e9c..eb17147b5 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -77,7 +77,7 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate = .lettersSpacing = 1, .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -1186,7 +1186,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y) printer.currentChar = text; printer.windowId = windowId; - printer.fontId = 1; + printer.fontId = FONT_NORMAL; printer.x = x; printer.y = y; printer.currentX = x; @@ -1222,7 +1222,7 @@ static void DaycarePrintMonLvl(struct DayCare *daycare, u8 windowId, u32 daycare level = GetLevelAfterDaycareSteps(&daycare->mons[daycareSlotId].mon, daycare->mons[daycareSlotId].steps); ConvertIntToDecimalStringN(intText, level, STR_CONV_MODE_LEFT_ALIGN, 3); StringAppend(lvlText, intText); - x = GetStringRightAlignXOffset(1, lvlText, 112); + x = GetStringRightAlignXOffset(FONT_NORMAL, lvlText, 112); DaycareAddTextPrinter(windowId, lvlText, x, y); } diff --git a/src/decoration.c b/src/decoration.c index 838b5cb66..52d1054c9 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -315,7 +315,7 @@ static const struct ListMenuTemplate sDecorationItemsListMenuTemplate = .lettersSpacing = FALSE, .itemVerticalPadding = 0, .scrollMultiple = FALSE, - .fontId = 7 + .fontId = FONT_NARROW }; #include "data/decoration/icon.h" @@ -615,7 +615,7 @@ static void HandleDecorationActionsMenuInput(u8 taskId) static void PrintCurMainMenuDescription(void) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sSecretBasePCMenuItemDescriptions[sDecorationActionsCursorPos], 0, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sSecretBasePCMenuItemDescriptions[sDecorationActionsCursorPos], 0, 0, 2, 1, 3); } static void DecorationMenuAction_Decorate(u8 taskId) @@ -728,7 +728,7 @@ static void PrintDecorationCategoryMenuItems(u8 taskId) PrintDecorationCategoryMenuItem(windowId, i, 8, i * 16, FALSE, TEXT_SPEED_FF); } - AddTextPrinterParameterized(windowId, 1, gTasks[taskId].tDecorationMenuCommand == DECOR_MENU_TRADE ? gText_Exit : gText_Cancel, 8, i * 16 + 1, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gTasks[taskId].tDecorationMenuCommand == DECOR_MENU_TRADE ? gText_Exit : gText_Cancel, 8, i * 16 + 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); } @@ -742,12 +742,12 @@ static void PrintDecorationCategoryMenuItem(u8 winid, u8 category, u8 x, u8 y, b ColorMenuItemString(gStringVar4, disabled); str = StringLength(gStringVar4) + gStringVar4; StringCopy(str, sDecorationCategoryNames[category]); - AddTextPrinterParameterized(winid, 1, gStringVar4, x, y, speed, NULL); + AddTextPrinterParameterized(winid, FONT_NORMAL, gStringVar4, x, y, speed, NULL); str = ConvertIntToDecimalStringN(str, GetNumOwnedDecorationsInCategory(category), STR_CONV_MODE_RIGHT_ALIGN, 2); *(str++) = CHAR_SLASH; ConvertIntToDecimalStringN(str, gDecorationInventories[category].size, STR_CONV_MODE_RIGHT_ALIGN, 2); - x = GetStringRightAlignXOffset(1, gStringVar4, width); - AddTextPrinterParameterized(winid, 1, gStringVar4, x, y, speed, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, width); + AddTextPrinterParameterized(winid, FONT_NORMAL, gStringVar4, x, y, speed, NULL); } static void ColorMenuItemString(u8 *str, bool8 disabled) @@ -1024,7 +1024,7 @@ static void PrintDecorationItemDescription(s32 itemIndex) else str = gDecorations[gCurDecorationItems[itemIndex]].description; - AddTextPrinterParameterized(windowId, 1, str, 0, 1, 0, 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, str, 0, 1, 0, 0); } static void RemoveDecorationItemsOtherWindows(void) diff --git a/src/diploma.c b/src/diploma.c index c68dc1000..ffb1447eb 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -205,5 +205,5 @@ static void PrintDiplomaText(u8 *text, u8 var1, u8 var2) { u8 color[3] = {0, 2, 3}; - AddTextPrinterParameterized4(0, 1, var1, var2, 0, 0, color, -1, text); + AddTextPrinterParameterized4(0, FONT_NORMAL, var1, var2, 0, 0, color, -1, text); } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index d7361ce96..838e8ed94 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -2954,10 +2954,10 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId) { case 0: window = sWindowTemplates_Records; - width = GetStringWidth(1, gText_BerryPickingRecords, 0); + width = GetStringWidth(FONT_NORMAL, gText_BerryPickingRecords, 0); for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) { - widthCurr = GetStringWidth(1, sRecordsTexts[i], 0) + 50; + widthCurr = GetStringWidth(FONT_NORMAL, sRecordsTexts[i], 0) + 50; if (widthCurr > width) width = widthCurr; } @@ -3008,14 +3008,14 @@ static void PrintRecordsText(u8 windowId, s32 width) LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(windowId, 1, gText_BerryPickingRecords, GetStringCenterAlignXOffset(1, gText_BerryPickingRecords, width * 8), 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_BerryPickingRecords, GetStringCenterAlignXOffset(FONT_NORMAL, gText_BerryPickingRecords, width * 8), 1, TEXT_SPEED_FF, NULL); for (i = 0; i < NUM_RECORD_TYPES; i++) { ConvertIntToDecimalStringN(gStringVar1, recordNums[i], STR_CONV_MODE_LEFT_ALIGN, sRecordNumMaxDigits[i]); - numWidth = GetStringWidth(1, gStringVar1, -1); - AddTextPrinterParameterized(windowId, 1, sRecordsTexts[i], 0, sRecordTextYCoords[i][0], TEXT_SPEED_FF, NULL); + numWidth = GetStringWidth(FONT_NORMAL, gStringVar1, -1); + AddTextPrinterParameterized(windowId, FONT_NORMAL, sRecordsTexts[i], 0, sRecordTextYCoords[i][0], TEXT_SPEED_FF, NULL); x = (width * 8) - numWidth; - AddTextPrinterParameterized(windowId, 1, gStringVar1, x, sRecordNumYCoords[i][0], TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar1, x, sRecordNumYCoords[i][0], TEXT_SPEED_FF, NULL); } PutWindowTilemap(windowId); } @@ -4640,7 +4640,7 @@ static void ShowNames(void) { colorsId = COLORID_GRAY; playerId = GetPlayerIdByPos(i); - left = (56 - GetStringWidth(1, GetPlayerName(playerId), -1)) / 2u; + left = (56 - GetStringWidth(FONT_NORMAL, GetPlayerName(playerId), -1)) / 2u; window.tilemapLeft = coords->left; window.tilemapTop = coords->top; sGfx->windowIds[i] = AddWindow(&window); @@ -4649,7 +4649,7 @@ static void ShowNames(void) if (playerId == GetMultiplayerId()) colorsId = COLORID_BLUE; name = GetPlayerName(playerId); - AddTextPrinterParameterized3(sGfx->windowIds[i], 1, left, 1, sTextColorTable[colorsId], -1, name); + AddTextPrinterParameterized3(sGfx->windowIds[i], FONT_NORMAL, left, 1, sTextColorTable[colorsId], -1, name); CopyWindowToVram(sGfx->windowIds[i], 2); window.baseBlock += 0xE; DrawMessageWindow(&window); @@ -4726,22 +4726,22 @@ static void PrintRankedScores(u8 numPlayers_) } // Print text - x = 216 - GetStringWidth(1, gText_SpacePoints, 0); + x = 216 - GetStringWidth(FONT_NORMAL, gText_SpacePoints, 0); for (i = 0; i < numPlayers; i++) { u8 colorsId = COLORID_GRAY; u8 playerId = playersByRanking[i]; u32 points = scoreResults[playerId].score; - AddTextPrinterParameterized(sGfx->windowIds[1], 1, sRankingTexts[scoreResults[playerId].ranking], 8, sRankingYCoords[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, sRankingTexts[scoreResults[playerId].ranking], 8, sRankingYCoords[i], -1, NULL); if (playerId == GetMultiplayerId()) colorsId = COLORID_BLUE; name = GetPlayerName(playerId); - AddTextPrinterParameterized3(sGfx->windowIds[1], 1, 28, sRankingYCoords[i], sTextColorTable[colorsId], -1, name); + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_NORMAL, 28, sRankingYCoords[i], sTextColorTable[colorsId], -1, name); ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_LEFT_ALIGN, 7); - numWidth = GetStringWidth(1, numString, -1); - AddTextPrinterParameterized(sGfx->windowIds[1], 1, numString, x - numWidth, sRankingYCoords[i], -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[1], 1, gText_SpacePoints, x, sRankingYCoords[i], -1, NULL); + numWidth = GetStringWidth(FONT_NORMAL, numString, -1); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, numString, x - numWidth, sRankingYCoords[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, gText_SpacePoints, x, sRankingYCoords[i], -1, NULL); } } @@ -4770,10 +4770,10 @@ static void ShowResults(void) case 2: FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(1, gText_BerryPickingResults, -1); + strWidth = GetStringWidth(FONT_NORMAL, gText_BerryPickingResults, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_BerryPickingResults, x, 1, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[1], 1, gText_10P30P50P50P, 68, 17, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_NORMAL, gText_BerryPickingResults, x, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, gText_10P30P50P50P, 68, 17, -1, NULL); for (i = 0; i < numPlayers; i++) { u8 colorsId = COLORID_GRAY; @@ -4781,7 +4781,7 @@ static void ShowResults(void) colorsId = COLORID_BLUE; name = GetPlayerName(i); - AddTextPrinterParameterized3(sGfx->windowIds[1], 1, 0, sResultsYCoords[i], sTextColorTable[colorsId], -1, name); + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_NORMAL, 0, sResultsYCoords[i], sTextColorTable[colorsId], -1, name); for (j = 0; j < 4; j++) { u32 width; @@ -4789,13 +4789,13 @@ static void ShowResults(void) u16 maxBerriesPicked = Min(GetHighestBerryResult(j), MAX_BERRIES); ConvertIntToDecimalStringN(gStringVar4, berriesPicked, STR_CONV_MODE_LEFT_ALIGN, 4); - width = GetStringWidth(1, gStringVar4, -1); + width = GetStringWidth(FONT_NORMAL, gStringVar4, -1); // If player got the most of a berry type, highlight their number in red if (maxBerriesPicked == berriesPicked && maxBerriesPicked != 0) - AddTextPrinterParameterized3(sGfx->windowIds[1], 1, sResultsXCoords[j] - width, sResultsYCoords[i], sTextColorTable[COLORID_RED], -1, gStringVar4); + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_NORMAL, sResultsXCoords[j] - width, sResultsYCoords[i], sTextColorTable[COLORID_RED], -1, gStringVar4); else - AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, sResultsXCoords[j] - width, sResultsYCoords[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, gStringVar4, sResultsXCoords[j] - width, sResultsYCoords[i], -1, NULL); } } CopyWindowToVram(sGfx->windowIds[0], 2); @@ -4824,9 +4824,9 @@ static void ShowResults(void) case 5: FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(1, gText_AnnouncingRankings, -1); + strWidth = GetStringWidth(FONT_NORMAL, gText_AnnouncingRankings, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_AnnouncingRankings, x, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_NORMAL, gText_AnnouncingRankings, x, 1, -1, NULL); sGfx->state++; break; case 6: @@ -4870,14 +4870,14 @@ static void ShowResults(void) PlayNewMapMusic(MUS_LEVEL_UP); FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(1, gText_AnnouncingPrizes, -1); + strWidth = GetStringWidth(FONT_NORMAL, gText_AnnouncingPrizes, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_AnnouncingPrizes, x, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_NORMAL, gText_AnnouncingPrizes, x, 1, -1, NULL); DynamicPlaceholderTextUtil_Reset(); CopyItemName(GetPrizeItemId(), gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FirstPlacePrize); - AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, 0, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, gStringVar4, 0, 1, -1, NULL); prizeState = TryGivePrize(); if (prizeState != PRIZE_RECEIVED && prizeState != NO_PRIZE) { @@ -4888,7 +4888,7 @@ static void ShowResults(void) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_CantHoldAnyMore); else if (prizeState == PRIZE_FILLED_BAG) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FilledStorageSpace); - AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, 0, 41, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_NORMAL, gStringVar4, 0, 41, -1, NULL); } CopyWindowToVram(sGfx->windowIds[0], 2); CopyWindowToVram(sGfx->windowIds[1], 2); @@ -4946,10 +4946,10 @@ static void Msg_WantToPlayAgain(void) // Print text FillWindowPixelBuffer(sGfx->windowIds[WIN_PLAY_AGAIN], PIXEL_FILL(1)); FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); - AddTextPrinterParameterized(sGfx->windowIds[WIN_PLAY_AGAIN], 1, gText_WantToPlayAgain, 0, 5, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_Yes, 8, 1, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_No, 8, 17, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_SelectorArrow2, 0, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_PLAY_AGAIN], FONT_NORMAL, gText_WantToPlayAgain, 0, 5, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_SelectorArrow2, 0, 1, -1, NULL); CopyWindowToVram(sGfx->windowIds[WIN_PLAY_AGAIN], 2); CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], 2); sGfx->state++; @@ -4970,9 +4970,9 @@ static void Msg_WantToPlayAgain(void) if (y == PLAY_AGAIN_NONE) y = PLAY_AGAIN_YES; FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_Yes, 8, 1, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_No, 8, 17, -1, NULL); - AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_NORMAL, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], 3); // Increment state only if A or B button have been pressed. @@ -5025,7 +5025,7 @@ static void Msg_SavingDontTurnOff(void) { case 0: DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); sGfx->state++; break; case 1: @@ -5063,7 +5063,7 @@ static void Msg_CommunicationStandby(void) break; case 1: FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_CommunicationStandby3, 0, 5, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_NORMAL, gText_CommunicationStandby3, 0, 5, -1, NULL); CopyWindowToVram(sGfx->windowIds[0], 2); sGfx->state++; break; @@ -5103,7 +5103,7 @@ static void Msg_SomeoneDroppedOut(void) break; case 1: FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_SomeoneDroppedOut, 0, 5, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_NORMAL, gText_SomeoneDroppedOut, 0, 5, -1, NULL); CopyWindowToVram(sGfx->windowIds[0], 2); sGfx->state++; break; diff --git a/src/easy_chat.c b/src/easy_chat.c index 625e8cd9e..2adcaf1d2 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -3176,7 +3176,7 @@ static bool8 UpdateMainCursor(void) else { CopyEasyChatWord(str, *ecWord); - stringWidth = GetStringWidth(1, str, 0); + stringWidth = GetStringWidth(FONT_NORMAL, str, 0); } trueStringWidth = stringWidth + 17; @@ -3930,9 +3930,9 @@ static void PrintTitle(void) if (!titleText) return; - xOffset = GetStringCenterAlignXOffset(1, titleText, 144); + xOffset = GetStringCenterAlignXOffset(FONT_NORMAL, titleText, 144); FillWindowPixelBuffer(0, PIXEL_FILL(0)); - PrintEasyChatTextWithColors(0, 1, titleText, xOffset, 1, TEXT_SPEED_FF, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY); + PrintEasyChatTextWithColors(0, FONT_NORMAL, titleText, xOffset, 1, TEXT_SPEED_FF, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY); PutWindowTilemap(0); CopyWindowToVram(0, 3); } @@ -4003,10 +4003,10 @@ static void PrintEasyChatStdMessage(u8 msgId) FillWindowPixelBuffer(1, PIXEL_FILL(1)); if (text1) - PrintEasyChatText(1, 1, text1, 0, 1, TEXT_SPEED_FF, 0); + PrintEasyChatText(1, FONT_NORMAL, text1, 0, 1, TEXT_SPEED_FF, 0); if (text2) - PrintEasyChatText(1, 1, text2, 0, 17, TEXT_SPEED_FF, 0); + PrintEasyChatText(1, FONT_NORMAL, text2, 0, 17, TEXT_SPEED_FF, 0); CopyWindowToVram(1, 3); } @@ -4099,7 +4099,7 @@ static void PrintCurrentPhrase(void) } *str = EOS; - PrintEasyChatText(sScreenControl->windowId, 1, sScreenControl->phrasePrintBuffer, 0, i * 16 + 1, TEXT_SPEED_FF, 0); + PrintEasyChatText(sScreenControl->windowId, FONT_NORMAL, sScreenControl->phrasePrintBuffer, 0, i * 16 + 1, TEXT_SPEED_FF, 0); } CopyWindowToVram(sScreenControl->windowId, 3); @@ -4245,7 +4245,7 @@ static void PrintKeyboardGroupNames(void) return; } - PrintEasyChatText(2, 1, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SPEED_FF, NULL); + PrintEasyChatText(2, FONT_NORMAL, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SPEED_FF, NULL); } y += 16; @@ -4257,7 +4257,7 @@ static void PrintKeyboardAlphabet(void) u32 i; for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardAlphabet); i++) - PrintEasyChatText(2, 1, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SPEED_FF, NULL); + PrintEasyChatText(2, FONT_NORMAL, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SPEED_FF, NULL); } static void PrintInitialWordSelectText(void) @@ -4328,9 +4328,9 @@ static void PrintWordSelectText(u8 scrollOffset, u8 numRows) { CopyEasyChatWordPadded(sScreenControl->wordSelectPrintBuffer, easyChatWord, 0); if (!DummyWordCheck(easyChatWord)) - PrintEasyChatText(2, 1, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, NULL); + PrintEasyChatText(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, NULL); else // Never reached - PrintEasyChatTextWithColors(2, 1, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY); + PrintEasyChatTextWithColors(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY); } } @@ -5082,7 +5082,7 @@ static void AddMainScreenButtonWindow(void) if (str) { int x = sFooterOptionXOffsets[footerIndex][i]; - PrintEasyChatText(windowId, 1, str, x, 1, 0, NULL); + PrintEasyChatText(windowId, FONT_NORMAL, str, x, 1, 0, NULL); } } diff --git a/src/egg_hatch.c b/src/egg_hatch.c index e491b7b14..25a61fcf6 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -866,7 +866,7 @@ static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed) sEggHatchData->textColor[0] = 0; sEggHatchData->textColor[1] = 5; sEggHatchData->textColor[2] = 6; - AddTextPrinterParameterized4(windowId, 1, x, y, 0, 0, sEggHatchData->textColor, speed, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, 0, sEggHatchData->textColor, speed, string); } u8 GetEggCyclesToSubtract(void) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 5b1857297..a1fbb0b6e 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -5065,7 +5065,7 @@ static void InitMovementNormal(struct ObjectEvent *objectEvent, struct Sprite *s static void StartRunningAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction) { - InitNpcForMovement(objectEvent, sprite, direction, 1); + InitNpcForMovement(objectEvent, sprite, direction, MOVE_SPEED_FAST_1); SetStepAnimHandleAlternation(objectEvent, sprite, GetRunningDirectionAnimNum(objectEvent->facingDirection)); } @@ -8223,15 +8223,19 @@ static const SpriteStepFunc sStep8Funcs[] = { }; static const SpriteStepFunc *const sNpcStepFuncTables[] = { - sStep1Funcs, - sStep2Funcs, - sStep3Funcs, - sStep4Funcs, - sStep8Funcs, + [MOVE_SPEED_NORMAL] = sStep1Funcs, + [MOVE_SPEED_FAST_1] = sStep2Funcs, + [MOVE_SPEED_FAST_2] = sStep3Funcs, + [MOVE_SPEED_FASTER] = sStep4Funcs, + [MOVE_SPEED_FASTEST] = sStep8Funcs, }; static const s16 sStepTimes[] = { - 16, 8, 6, 4, 2 + [MOVE_SPEED_NORMAL] = 16, + [MOVE_SPEED_FAST_1] = 8, + [MOVE_SPEED_FAST_2] = 6, + [MOVE_SPEED_FASTER] = 4, + [MOVE_SPEED_FASTEST] = 2, }; static bool8 NpcTakeStep(struct Sprite *sprite) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index bc86a8008..00ac41e52 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1805,7 +1805,7 @@ static bool8 Fishing_ShowDots(struct Task *task) } else { - AddTextPrinterParameterized(0, 1, dot, task->tNumDots * 8, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, dot, task->tNumDots * 8, 1, 0, NULL); task->tNumDots++; } } @@ -1854,7 +1854,7 @@ static bool8 Fishing_CheckForBite(struct Task *task) static bool8 Fishing_GotBite(struct Task *task) { AlignFishingAnimationFrames(); - AddTextPrinterParameterized(0, 1, gText_OhABite, 0, 17, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_OhABite, 0, 17, 0, NULL); task->tStep++; task->tFrameCounter = 0; return FALSE; @@ -1909,7 +1909,7 @@ static bool8 Fishing_MonOnHook(struct Task *task) { AlignFishingAnimationFrames(); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gText_PokemonOnHook, 1, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_PokemonOnHook, 1, 0, 2, 1, 3); task->tStep++; task->tFrameCounter = 0; return FALSE; @@ -1956,7 +1956,7 @@ static bool8 Fishing_NotEvenNibble(struct Task *task) AlignFishingAnimationFrames(); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gText_NotEvenANibble, 1, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_NotEvenANibble, 1, 0, 2, 1, 3); task->tStep = FISHING_SHOW_RESULT; return TRUE; } @@ -1966,7 +1966,7 @@ static bool8 Fishing_GotAway(struct Task *task) AlignFishingAnimationFrames(); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gText_ItGotAway, 1, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_ItGotAway, 1, 0, 2, 1, 3); task->tStep++; return TRUE; } diff --git a/src/field_region_map.c b/src/field_region_map.c index 99def4901..9dcc65c9a 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -151,8 +151,8 @@ static void FieldUpdateRegionMap(void) break; case 1: DrawStdFrameWithCustomTileAndPalette(1, 0, 0x27, 0xd); - offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38); - AddTextPrinterParameterized(1, 1, gText_Hoenn, offset, 1, 0, NULL); + offset = GetStringCenterAlignXOffset(FONT_NORMAL, gText_Hoenn, 0x38); + AddTextPrinterParameterized(1, FONT_NORMAL, gText_Hoenn, offset, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); DrawStdFrameWithCustomTileAndPalette(0, 0, 0x27, 0xd); PrintRegionMapSecName(); @@ -207,7 +207,7 @@ static void PrintRegionMapSecName(void) if (sFieldRegionMapHandler->regionMap.mapSecType != MAPSECTYPE_NONE) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); } else diff --git a/src/field_specials.c b/src/field_specials.c index 22fd6872b..c85940162 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1910,11 +1910,11 @@ void ShowDeptStoreElevatorFloorSelect(void) sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate); SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, 0); - xPos = GetStringCenterAlignXOffset(1, gText_ElevatorNowOn, 64); - AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); - xPos = GetStringCenterAlignXOffset(1, gDeptStoreFloorNames[gSpecialVar_0x8005], 64); - AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], 64); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); PutWindowTilemap(sTutorMoveAndElevatorWindowId); CopyWindowToVram(sTutorMoveAndElevatorWindowId, 3); @@ -2653,7 +2653,7 @@ static void InitScrollableMultichoice(void) gScrollableMultichoice_ListMenuTemplate.lettersSpacing = 0; gScrollableMultichoice_ListMenuTemplate.itemVerticalPadding = 0; gScrollableMultichoice_ListMenuTemplate.scrollMultiple = 0; - gScrollableMultichoice_ListMenuTemplate.fontId = 1; + gScrollableMultichoice_ListMenuTemplate.fontId = FONT_NORMAL; gScrollableMultichoice_ListMenuTemplate.cursorKind = 0; } @@ -2957,8 +2957,8 @@ void UpdateBattlePointsWindow(void) u8 string[32]; u32 x; StringCopy(ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->frontier.battlePoints, STR_CONV_MODE_RIGHT_ALIGN, 4), gText_BP); - x = GetStringRightAlignXOffset(1, string, 48); - AddTextPrinterParameterized(sBattlePointsWindowId, 1, string, x, 1, 0, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, string, 48); + AddTextPrinterParameterized(sBattlePointsWindowId, FONT_NORMAL, string, x, 1, 0, NULL); } void ShowBattlePointsWindow(void) @@ -3047,7 +3047,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) switch (menu) { case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: - AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF) { ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]); @@ -3060,7 +3060,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) } break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: - AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF) { ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]); @@ -3073,11 +3073,11 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) } break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: - AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Vitamins[selection]); break; case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: - AddTextPrinterParameterized2(0, 1, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_HoldItems[selection]); break; } @@ -3216,11 +3216,11 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection) FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48); if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) { - AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); } else { - AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, 1, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); + AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); } } } @@ -3244,9 +3244,9 @@ void ScrollableMultichoice_RedrawPersistentMenu(void) SetStandardWindowBorderStyle(task->tWindowId, 0); for (i = 0; i < MAX_SCROLL_MULTI_ON_SCREEN; i++) - AddTextPrinterParameterized5(task->tWindowId, 1, sScrollableMultichoiceOptions[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0); + AddTextPrinterParameterized5(task->tWindowId, FONT_NORMAL, sScrollableMultichoiceOptions[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0); - AddTextPrinterParameterized(task->tWindowId, 1, gText_SelectorArrow, 0, selectedRow * 16, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(task->tWindowId, FONT_NORMAL, gText_SelectorArrow, 0, selectedRow * 16, TEXT_SPEED_FF, NULL); PutWindowTilemap(task->tWindowId); CopyWindowToVram(task->tWindowId, 3); } diff --git a/src/fonts.c b/src/fonts.c new file mode 100644 index 000000000..df904baca --- /dev/null +++ b/src/fonts.c @@ -0,0 +1,292 @@ +#include "global.h" + +ALIGNED(4) const u16 gFontSmallNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/small_narrow.latfont"); +ALIGNED(4) const u8 gFontSmallNarrowLatinGlyphWidths[] = { + 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 3, 4, 5, 5, 5, 5, 4, 3, + 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 6, 3, + 3, 3, 3, 3, 8, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 5, 3, 8, 8, 8, 8, 8, 8, 8, 4, 5, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 8, 8, 8, 8, 1, 2, 3, + 4, 5, 6, 7, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 3, 5, 5, + 5, 5, 5, 3, 3, 5, 5, 5, 3, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 5, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, + 3, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontSmallLatinGlyphs[] = INCBIN_U16("graphics/fonts/small.latfont"); +ALIGNED(4) const u8 gFontSmallLatinGlyphWidths[] = { + 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3, + 4, 4, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 8, 7, 8, 3, + 3, 3, 3, 3, 8, 8, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 4, 7, 5, 5, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 8, 8, 8, 8, 1, 2, 3, + 4, 5, 6, 7, 5, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 8, 5, 8, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, + 7, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontNarrowLatinGlyphs[] = INCBIN_U16("graphics/fonts/narrow.latfont"); +ALIGNED(4) const u8 gFontNarrowLatinGlyphWidths[] = { + 3, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 4, 4, 5, 5, 5, + 8, 5, 5, 5, 5, 6, 5, 5, 3, 5, 5, 5, 5, 5, 4, 3, + 4, 4, 5, 5, 5, 8, 5, 5, 5, 5, 5, 6, 9, 6, 6, 3, + 3, 3, 3, 3, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 5, 4, 8, 8, 8, 7, 8, 8, 4, 4, 6, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 7, 7, 7, 7, 1, 2, 3, + 4, 5, 6, 7, 5, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 3, 5, 3, + 5, 5, 5, 3, 3, 5, 5, 6, 3, 6, 6, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, + 3, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 10, 10, 10, 10, 8, 8, 10, 8, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontShortLatinGlyphs[] = INCBIN_U16("graphics/fonts/short.latfont"); +ALIGNED(4) const u8 gFontShortLatinGlyphWidths[] = { + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 6, 6, 6, + 8, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 6, 6, 6, 6, 3, + 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 9, 8, 8, 3, + 3, 3, 3, 3, 10, 8, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 6, 6, 6, 8, 8, 8, 8, 8, 8, 4, 6, 8, 5, 5, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 6, + 3, 3, 3, 3, 3, 3, 3, 6, 3, 12, 12, 12, 12, 1, 2, 3, + 4, 5, 6, 7, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 5, + 6, 6, 6, 3, 3, 6, 6, 8, 5, 9, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 4, 6, 5, + 5, 6, 5, 6, 6, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 8, + 5, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 12, 12, 12, 12, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontNormalLatinGlyphs[] = INCBIN_U16("graphics/fonts/normal.latfont"); +ALIGNED(4) const u8 gFontNormalLatinGlyphWidths[] = { + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 6, 6, 6, + 8, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 6, 6, 6, 6, 3, + 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 9, 7, 6, 3, + 3, 3, 3, 3, 10, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 6, 6, 4, 8, 8, 8, 7, 8, 8, 4, 6, 6, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 6, + 3, 3, 3, 3, 3, 3, 3, 6, 3, 7, 7, 7, 7, 1, 2, 3, + 4, 5, 6, 7, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 3, 6, 3, + 6, 6, 6, 3, 3, 6, 6, 6, 3, 7, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 5, 6, + 4, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 8, + 3, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 10, 10, 10, 10, 8, 10, 10, 8, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, +}; + +ALIGNED(4) const u16 gFontSmallJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/small.hwjpnfont"); +ALIGNED(4) const u16 gFontNormalJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/normal.hwjpnfont"); + +ALIGNED(4) const u16 gFontFRLGMaleJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/frlg_male.fwjpnfont"); +ALIGNED(4) const u8 gFontFRLGMaleJapaneseGlyphWidths[] = { + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 9, 10, 10, 10, + 8, 10, 10, 10, 10, 8, 8, 8, 10, 10, 8, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 2, 4, 6, + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 5, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +}; + +ALIGNED(4) const u16 gFontFRLGFemaleJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/frlg_female.fwjpnfont"); +ALIGNED(4) const u8 gFontFRLGFemaleJapaneseGlyphWidths[] = { + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, + 9, 9, 9, 9, 9, 9, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 9, 10, 10, 10, + 8, 10, 10, 10, 10, 8, 8, 8, 10, 10, 8, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 2, 4, 6, + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 5, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +}; + +ALIGNED(4) const u16 gFontShortJapaneseGlyphs[] = INCBIN_U16("graphics/fonts/short.fwjpnfont"); +ALIGNED(4) const u8 gFontShortJapaneseGlyphWidths[] = { + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 9, 10, 10, 10, + 8, 10, 10, 10, 10, 8, 8, 8, 10, 10, 8, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 2, 4, 6, + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 5, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +}; diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 53bd68eac..699e19c7a 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -1150,16 +1150,16 @@ static void ShowAndPrintWindows(void) FillWindowPixelBuffer(i, PIXEL_FILL(0)); } - x = GetStringCenterAlignXOffset(1, gText_SymbolsEarned, 96); - AddTextPrinterParameterized3(WINDOW_EARNED_SYMBOLS, 1, x, 5, sTextColors[0], 0, gText_SymbolsEarned); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gText_SymbolsEarned, 96); + AddTextPrinterParameterized3(WINDOW_EARNED_SYMBOLS, FONT_NORMAL, x, 5, sTextColors[0], 0, gText_SymbolsEarned); - x = GetStringCenterAlignXOffset(1, gText_BattleRecord, 96); - AddTextPrinterParameterized3(WINDOW_BATTLE_RECORD, 1, x, 5, sTextColors[0], 0, gText_BattleRecord); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gText_BattleRecord, 96); + AddTextPrinterParameterized3(WINDOW_BATTLE_RECORD, FONT_NORMAL, x, 5, sTextColors[0], 0, gText_BattleRecord); - AddTextPrinterParameterized3(WINDOW_BATTLE_POINTS, 8, 5, 4, sTextColors[0], 0, gText_BattlePoints); + AddTextPrinterParameterized3(WINDOW_BATTLE_POINTS, FONT_SMALL_NARROW, 5, 4, sTextColors[0], 0, gText_BattlePoints); ConvertIntToDecimalStringN(gStringVar4, sPassData->battlePoints, STR_CONV_MODE_LEFT_ALIGN, 5); - x = GetStringRightAlignXOffset(8, gStringVar4, 91); - AddTextPrinterParameterized3(WINDOW_BATTLE_POINTS, 8, x, 16, sTextColors[0], 0, gStringVar4); + x = GetStringRightAlignXOffset(FONT_SMALL_NARROW, gStringVar4, 91); + AddTextPrinterParameterized3(WINDOW_BATTLE_POINTS, FONT_SMALL_NARROW, x, 16, sTextColors[0], 0, gStringVar4); sPassData->cursorArea = GetCursorAreaFromCoords(sPassData->cursorX - 5, sPassData->cursorY + 5); sPassData->previousCursorArea = CURSOR_AREA_NOTHING; @@ -1176,9 +1176,9 @@ static void PrintAreaDescription(u8 cursorArea) FillWindowPixelBuffer(WINDOW_DESCRIPTION, PIXEL_FILL(0)); if (cursorArea == CURSOR_AREA_RECORD && !sPassData->hasBattleRecord) - AddTextPrinterParameterized3(WINDOW_DESCRIPTION, 1, 2, 0, sTextColors[1], 0, sPassAreaDescriptions[CURSOR_AREA_NOTHING]); + AddTextPrinterParameterized3(WINDOW_DESCRIPTION, FONT_NORMAL, 2, 0, sTextColors[1], 0, sPassAreaDescriptions[CURSOR_AREA_NOTHING]); else if (cursorArea != CURSOR_AREA_NOTHING) - AddTextPrinterParameterized3(WINDOW_DESCRIPTION, 1, 2, 0, sTextColors[1], 0, sPassAreaDescriptions[cursorArea]); + AddTextPrinterParameterized3(WINDOW_DESCRIPTION, FONT_NORMAL, 2, 0, sTextColors[1], 0, sPassAreaDescriptions[cursorArea]); CopyWindowToVram(WINDOW_DESCRIPTION, 3); CopyBgTilemapBufferToVram(0); @@ -1715,12 +1715,12 @@ static void PrintOnFrontierMap(void) for (i = 0; i < NUM_FRONTIER_FACILITIES; i++) { if (i == sMapData->cursorPos) - AddTextPrinterParameterized3(MAP_WINDOW_NAME, 7, 4, (i * 16) + 1, sTextColors[2], 0, sMapLandmarks[i].name); + AddTextPrinterParameterized3(MAP_WINDOW_NAME, FONT_NARROW, 4, (i * 16) + 1, sTextColors[2], 0, sMapLandmarks[i].name); else - AddTextPrinterParameterized3(MAP_WINDOW_NAME, 7, 4, (i * 16) + 1, sTextColors[1], 0, sMapLandmarks[i].name); + AddTextPrinterParameterized3(MAP_WINDOW_NAME, FONT_NARROW, 4, (i * 16) + 1, sTextColors[1], 0, sMapLandmarks[i].name); } - AddTextPrinterParameterized3(MAP_WINDOW_DESCRIPTION, 1, 4, 0, sTextColors[0], 0, sMapLandmarks[sMapData->cursorPos].description); + AddTextPrinterParameterized3(MAP_WINDOW_DESCRIPTION, FONT_NORMAL, 4, 0, sTextColors[0], 0, sMapLandmarks[sMapData->cursorPos].description); for (i = 0; i < MAP_WINDOW_COUNT; i++) CopyWindowToVram(i, 3); @@ -1743,8 +1743,8 @@ static void HandleFrontierMapCursorMove(u8 direction) sMapData->cursorPos = (oldCursorPos + 1) % NUM_FRONTIER_FACILITIES; } - AddTextPrinterParameterized3(MAP_WINDOW_NAME, 7, 4, (oldCursorPos * 16) + 1, sTextColors[1], 0, sMapLandmarks[oldCursorPos].name); - AddTextPrinterParameterized3(MAP_WINDOW_NAME, 7, 4, (sMapData->cursorPos * 16) + 1, sTextColors[2], 0, sMapLandmarks[sMapData->cursorPos].name); + AddTextPrinterParameterized3(MAP_WINDOW_NAME, FONT_NARROW, 4, (oldCursorPos * 16) + 1, sTextColors[1], 0, sMapLandmarks[oldCursorPos].name); + AddTextPrinterParameterized3(MAP_WINDOW_NAME, FONT_NARROW, 4, (sMapData->cursorPos * 16) + 1, sTextColors[2], 0, sMapLandmarks[sMapData->cursorPos].name); sMapData->cursorSprite->y = (sMapData->cursorPos * 16) + 8; @@ -1752,7 +1752,7 @@ static void HandleFrontierMapCursorMove(u8 direction) sMapData->mapIndicatorSprite->x = sMapLandmarks[sMapData->cursorPos].x; sMapData->mapIndicatorSprite->y = sMapLandmarks[sMapData->cursorPos].y; FillWindowPixelBuffer(MAP_WINDOW_DESCRIPTION, PIXEL_FILL(0)); - AddTextPrinterParameterized3(MAP_WINDOW_DESCRIPTION, 1, 4, 0, sTextColors[0], 0, sMapLandmarks[sMapData->cursorPos].description); + AddTextPrinterParameterized3(MAP_WINDOW_DESCRIPTION, FONT_NORMAL, 4, 0, sTextColors[0], 0, sMapLandmarks[sMapData->cursorPos].description); for (i = 0; i < MAP_WINDOW_COUNT; i++) CopyWindowToVram(i, 3); diff --git a/src/frontier_util.c b/src/frontier_util.c index ec3eba43a..25153b05c 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -958,9 +958,9 @@ static bool8 IsWinStreakActive(u32 challenge) static void PrintAligned(const u8 *str, s32 y) { - s32 x = GetStringCenterAlignXOffset(1, str, 224); + s32 x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 224); y = (y * 8) + 1; - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, y, TEXT_SPEED_FF, NULL); } static void PrintHyphens(s32 y) @@ -973,18 +973,18 @@ static void PrintHyphens(s32 y) text[i] = EOS; y = (y * 8) + 1; - AddTextPrinterParameterized(gRecordsWindowId, 1, text, 4, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, text, 4, y, TEXT_SPEED_FF, NULL); } // Battle Tower records. static void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x1, y, TEXT_SPEED_FF, NULL); if (num > MAX_STREAK) num = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_WinStreak); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void TowerPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1056,8 +1056,8 @@ static void ShowTowerResultsWindow(u8 battleMode) StringExpandPlaceholders(gStringVar4, gText_LinkMultiBattleRoomResults); PrintAligned(gStringVar4, 2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); TowerPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 132, 49); TowerPrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 132, 65); @@ -1079,10 +1079,10 @@ static u16 DomeGetWinStreak(u8 battleMode, u8 lvlMode) static void PrintTwoStrings(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str1, x1, y, TEXT_SPEED_FF, NULL); ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, str2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void DomePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1123,8 +1123,8 @@ static void ShowDomeResultsWindow(u8 battleMode) StringExpandPlaceholders(gStringVar4, gText_DoubleBattleTourneyResults); PrintAligned(gStringVar4, 0); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); DomePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 64, 121, 33); PrintTwoStrings(gText_Record, gText_ClearStreak, gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][FRONTIER_LVL_50], 64, 121, 49); @@ -1139,12 +1139,12 @@ static void ShowDomeResultsWindow(u8 battleMode) // Battle Palace records. static void PalacePrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x1, y, TEXT_SPEED_FF, NULL); if (num > MAX_STREAK) num = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_WinStreak); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void PalacePrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1199,8 +1199,8 @@ static void ShowPalaceResultsWindow(u8 battleMode) StringExpandPlaceholders(gStringVar4, gText_DoubleBattleHallResults); PrintAligned(gStringVar4, 2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); PalacePrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 72, 131, 49); PalacePrintRecordStreak(battleMode, FRONTIER_LVL_50, 72, 131, 65); @@ -1222,10 +1222,10 @@ static u16 PikeGetWinStreak(u8 lvlMode) static void PikePrintCleared(const u8 *str1, const u8 *str2, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str1, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str1, x1, y, TEXT_SPEED_FF, NULL); ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, str2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void PikePrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1251,8 +1251,8 @@ static void ShowPikeResultsWindow(void) FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1)); StringExpandPlaceholders(gStringVar4, gText_BattleChoiceResults); PrintAligned(gStringVar4, 0); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); PikePrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 114, 33); PikePrintCleared(gText_Record, gText_RoomsCleared, gSaveBlock2Ptr->frontier.pikeRecordStreaks[FRONTIER_LVL_50], 64, 114, 49); @@ -1267,12 +1267,12 @@ static void ShowPikeResultsWindow(void) // Battle Arena records. static void ArenaPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x1, y, TEXT_SPEED_FF, NULL); if (num > MAX_STREAK) num = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_KOsInARow); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void ArenaPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1314,8 +1314,8 @@ static void ShowArenaResultsWindow(void) PrintHyphens(10); StringExpandPlaceholders(gStringVar4, gText_SetKOTourneyResults); PrintAligned(gStringVar4, 2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 16, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 16, 97, TEXT_SPEED_FF, NULL); ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 72, 126, 49); ArenaPrintRecordStreak(FRONTIER_LVL_50, 72, 126, 65); ArenaPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 72, 126, 97); @@ -1327,16 +1327,16 @@ static void ShowArenaResultsWindow(void) // Battle Factory records. static void FactoryPrintStreak(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x1, y, TEXT_SPEED_FF, NULL); if (num1 > MAX_STREAK) num1 = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar1, num1, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_WinStreak); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); ConvertIntToDecimalStringN(gStringVar1, num2, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_TimesVar1); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x3, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x3, y, TEXT_SPEED_FF, NULL); } static void FactoryPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y) @@ -1403,9 +1403,9 @@ static void ShowFactoryResultsWindow(u8 battleMode) StringExpandPlaceholders(gStringVar4, gText_BattleSwapDoubleResults); PrintAligned(gStringVar4, 0); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); FactoryPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49); FactoryPrintRecordStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65); @@ -1418,12 +1418,12 @@ static void ShowFactoryResultsWindow(u8 battleMode) // Battle Pyramid records. static void PyramidPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y) { - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x1, y, TEXT_SPEED_FF, NULL); if (num > MAX_STREAK) num = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, gText_FloorsCleared); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x2, y, TEXT_SPEED_FF, NULL); } static void PyramidPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y) @@ -1464,8 +1464,8 @@ static void ShowPyramidResultsWindow(void) FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1)); StringExpandPlaceholders(gStringVar4, gText_BattleQuestResults); PrintAligned(gStringVar4, 2); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 49, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Lv502, 8, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL); PrintHyphens(10); PyramidPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 111, 49); PyramidPrintRecordStreak(FRONTIER_LVL_50, 64, 111, 65); @@ -1487,38 +1487,38 @@ static void ShowLinkContestResultsWindow(void) FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1)); StringExpandPlaceholders(gStringVar4, gText_LinkContestResults); - x = GetStringCenterAlignXOffset(1, gStringVar4, 208); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 1, TEXT_SPEED_FF, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 208); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, x, 1, TEXT_SPEED_FF, NULL); str = gText_1st; - x = GetStringRightAlignXOffset(1, str, 38) + 50; - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 38) + 50; + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, 25, TEXT_SPEED_FF, NULL); str = gText_2nd; - x = GetStringRightAlignXOffset(1, str, 38) + 88; - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 38) + 88; + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, 25, TEXT_SPEED_FF, NULL); str = gText_3rd; - x = GetStringRightAlignXOffset(1, str, 38) + 126; - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 38) + 126; + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, 25, TEXT_SPEED_FF, NULL); str = gText_4th; - x = GetStringRightAlignXOffset(1, str, 38) + 164; - AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 38) + 164; + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, str, x, 25, TEXT_SPEED_FF, NULL); x = 6; - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cool, x, 41, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Beauty, x, 57, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cute, x, 73, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Smart, x, 89, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Tough, x, 105, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Cool, x, 41, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Beauty, x, 57, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Cute, x, 73, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Smart, x, 89, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_Tough, x, 105, TEXT_SPEED_FF, NULL); for (i = 0; i < CONTEST_CATEGORIES_COUNT; i++) { for (j = 0; j < CONTESTANT_COUNT; j++) { ConvertIntToDecimalStringN(gStringVar4, gSaveBlock2Ptr->contestLinkResults[i][j], STR_CONV_MODE_RIGHT_ALIGN, 4); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, (j * 38) + 64, (i * 16) + 41, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, (j * 38) + 64, (i * 16) + 41, TEXT_SPEED_FF, NULL); } } @@ -2224,18 +2224,18 @@ static void Print1PRecord(s32 position, s32 x, s32 y, struct RankingHall1P *hall u8 text[32]; u16 winStreak; - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); hallRecord->name[PLAYER_NAME_LENGTH] = EOS; if (hallRecord->winStreak) { TVShowConvertInternationalString(text, hallRecord->name, hallRecord->language); - AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 2) * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, text, (x + 2) * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); winStreak = hallRecord->winStreak; if (winStreak > MAX_STREAK) winStreak = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[hallFacilityId]); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[hallFacilityId], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, sHallFacilityToRecordsText[hallFacilityId], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); } } @@ -2244,25 +2244,25 @@ static void Print2PRecord(s32 position, s32 x, s32 y, struct RankingHall2P *hall u8 text[32]; u16 winStreak; - AddTextPrinterParameterized(gRecordsWindowId, 1, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gText_123Dot[position], x * 8, (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); if (hallRecord->winStreak) { hallRecord->name1[PLAYER_NAME_LENGTH] = EOS; hallRecord->name2[PLAYER_NAME_LENGTH] = EOS; TVShowConvertInternationalString(text, hallRecord->name1, hallRecord->language); - AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 2) * 8, (8 * (y + 5 * position - 1)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, text, (x + 2) * 8, (8 * (y + 5 * position - 1)) + 1, TEXT_SPEED_FF, NULL); if (IsStringJapanese(hallRecord->name2)) TVShowConvertInternationalString(text, hallRecord->name2, LANGUAGE_JAPANESE); else StringCopy(text, hallRecord->name2); - AddTextPrinterParameterized(gRecordsWindowId, 1, text, (x + 4) * 8, (8 * (y + 5 * position + 1)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, text, (x + 4) * 8, (8 * (y + 5 * position + 1)) + 1, TEXT_SPEED_FF, NULL); winStreak = hallRecord->winStreak; if (winStreak > MAX_STREAK) winStreak = MAX_STREAK; ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4); StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[RANKING_HALL_TOWER_LINK]); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[RANKING_HALL_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, sHallFacilityToRecordsText[RANKING_HALL_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); } } @@ -2343,9 +2343,9 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode) StringCopy(gStringVar1, sRecordsWindowChallengeTexts[hallFacilityId][0]); StringExpandPlaceholders(gStringVar4, sRecordsWindowChallengeTexts[hallFacilityId][1]); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); - x = GetStringRightAlignXOffset(1, sLevelModeText[lvlMode], 0xD0); - AddTextPrinterParameterized(gRecordsWindowId, 1, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, sLevelModeText[lvlMode], 0xD0); + AddTextPrinterParameterized(gRecordsWindowId, FONT_NORMAL, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); if (hallFacilityId == RANKING_HALL_TOWER_LINK) { gSaveBlock2Ptr->frontier.opponentNames[0][PLAYER_NAME_LENGTH] = EOS; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 3cbe8df6e..8d69b03bc 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -514,7 +514,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) *lastSavedTeam = *sHofMonPtr; DrawDialogueFrame(0, 0); - AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_TrySaveData; } @@ -724,7 +724,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId) FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); HallOfFame_PrintPlayerInfo(1, 2); DrawDialogueFrame(0, 0); - AddTextPrinterParameterized2(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; } @@ -1093,7 +1093,7 @@ static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { sub_8198180(gText_AButtonExit, 8, TRUE); DrawDialogueFrame(0, 0); - AddTextPrinterParameterized2(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; } @@ -1114,7 +1114,7 @@ static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2) { FillWindowPixelBuffer(0, PIXEL_FILL(0)); PutWindowTilemap(0); - AddTextPrinterParameterized3(0, 1, GetStringCenterAlignXOffset(1, gText_WelcomeToHOF, 0xD0), 1, sMonInfoTextColors, 0, gText_WelcomeToHOF); + AddTextPrinterParameterized3(0, FONT_NORMAL, GetStringCenterAlignXOffset(FONT_NORMAL, gText_WelcomeToHOF, 0xD0), 1, sMonInfoTextColors, 0, gText_WelcomeToHOF); CopyWindowToVram(0, 3); } @@ -1150,7 +1150,7 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u *(stringPtr)++ = CHAR_QUESTION_MARK; } stringPtr[0] = EOS; - AddTextPrinterParameterized3(0, 1, 0x10, 1, sMonInfoTextColors, -1, text); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0x10, 1, sMonInfoTextColors, -1, text); } // nick, species names, gender and level @@ -1158,14 +1158,14 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u text[POKEMON_NAME_LENGTH] = EOS; if (currMon->species == SPECIES_EGG) { - width = GetStringCenterAlignXOffset(1, text, 0xD0); - AddTextPrinterParameterized3(0, 1, width, 1, sMonInfoTextColors, -1, text); + width = GetStringCenterAlignXOffset(FONT_NORMAL, text, 0xD0); + AddTextPrinterParameterized3(0, FONT_NORMAL, width, 1, sMonInfoTextColors, -1, text); CopyWindowToVram(0, 3); } else { - width = GetStringRightAlignXOffset(1, text, 0x80); - AddTextPrinterParameterized3(0, 1, width, 1, sMonInfoTextColors, -1, text); + width = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x80); + AddTextPrinterParameterized3(0, FONT_NORMAL, width, 1, sMonInfoTextColors, -1, text); text[0] = CHAR_SLASH; stringPtr = StringCopy(text + 1, gSpeciesNames[currMon->species]); @@ -1186,15 +1186,15 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u } stringPtr[0] = EOS; - AddTextPrinterParameterized3(0, 1, 0x80, 1, sMonInfoTextColors, -1, text); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0x80, 1, sMonInfoTextColors, -1, text); stringPtr = StringCopy(text, gText_Level); ConvertIntToDecimalStringN(stringPtr, currMon->lvl, STR_CONV_MODE_LEFT_ALIGN, 3); - AddTextPrinterParameterized3(0, 1, 0x24, 0x11, sMonInfoTextColors, -1, text); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0x24, 0x11, sMonInfoTextColors, -1, text); stringPtr = StringCopy(text, gText_IDNumber); ConvertIntToDecimalStringN(stringPtr, (u16)(currMon->tid), STR_CONV_MODE_LEADING_ZEROS, 5); - AddTextPrinterParameterized3(0, 1, 0x68, 0x11, sMonInfoTextColors, -1, text); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0x68, 0x11, sMonInfoTextColors, -1, text); CopyWindowToVram(0, 3); } @@ -1209,23 +1209,23 @@ static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2) FillWindowPixelBuffer(1, PIXEL_FILL(1)); PutWindowTilemap(1); DrawStdFrameWithCustomTileAndPalette(1, FALSE, 0x21D, 0xD); - AddTextPrinterParameterized3(1, 1, 0, 1, sPlayerInfoTextColors, -1, gText_Name); + AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 1, sPlayerInfoTextColors, -1, gText_Name); - width = GetStringRightAlignXOffset(1, gSaveBlock2Ptr->playerName, 0x70); - AddTextPrinterParameterized3(1, 1, width, 1, sPlayerInfoTextColors, -1, gSaveBlock2Ptr->playerName); + width = GetStringRightAlignXOffset(FONT_NORMAL, gSaveBlock2Ptr->playerName, 0x70); + AddTextPrinterParameterized3(1, FONT_NORMAL, width, 1, sPlayerInfoTextColors, -1, gSaveBlock2Ptr->playerName); trainerId = (gSaveBlock2Ptr->playerTrainerId[0]) | (gSaveBlock2Ptr->playerTrainerId[1] << 8); - AddTextPrinterParameterized3(1, 1, 0, 0x11, sPlayerInfoTextColors, 0, gText_IDNumber); + AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 0x11, sPlayerInfoTextColors, 0, gText_IDNumber); text[0] = (trainerId % 100000) / 10000 + CHAR_0; text[1] = (trainerId % 10000) / 1000 + CHAR_0; text[2] = (trainerId % 1000) / 100 + CHAR_0; text[3] = (trainerId % 100) / 10 + CHAR_0; text[4] = (trainerId % 10) / 1 + CHAR_0; text[5] = EOS; - width = GetStringRightAlignXOffset(1, text, 0x70); - AddTextPrinterParameterized3(1, 1, width, 0x11, sPlayerInfoTextColors, -1, text); + width = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x70); + AddTextPrinterParameterized3(1, FONT_NORMAL, width, 0x11, sPlayerInfoTextColors, -1, text); - AddTextPrinterParameterized3(1, 1, 0, 0x21, sPlayerInfoTextColors, -1, gText_Time); + AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 0x21, sPlayerInfoTextColors, -1, gText_Time); text[0] = (gSaveBlock2Ptr->playTimeHours / 100) + CHAR_0; text[1] = (gSaveBlock2Ptr->playTimeHours % 100) / 10 + CHAR_0; text[2] = (gSaveBlock2Ptr->playTimeHours % 10) + CHAR_0; @@ -1240,8 +1240,8 @@ static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2) text[5] = (gSaveBlock2Ptr->playTimeMinutes % 10) + CHAR_0; text[6] = EOS; - width = GetStringRightAlignXOffset(1, text, 0x70); - AddTextPrinterParameterized3(1, 1, width, 0x21, sPlayerInfoTextColors, -1, text); + width = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x70); + AddTextPrinterParameterized3(1, FONT_NORMAL, width, 0x21, sPlayerInfoTextColors, -1, text); CopyWindowToVram(1, 3); } diff --git a/src/international_string_util.c b/src/international_string_util.c index 21e3e4bee..e4b793b66 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -40,7 +40,7 @@ int GetMaxWidthInMenuTable(const struct MenuAction *actions, int numActions) for (maxWidth = 0, i = 0; i < numActions; i++) { - int stringWidth = GetStringWidth(1, actions[i].text, 0); + int stringWidth = GetStringWidth(FONT_NORMAL, actions[i].text, 0); if (stringWidth > maxWidth) maxWidth = stringWidth; } @@ -54,7 +54,7 @@ int GetMaxWidthInSubsetOfMenuTable(const struct MenuAction *actions, const u8* a for (maxWidth = 0, i = 0; i < numActions; i++) { - int stringWidth = GetStringWidth(1, actions[actionIds[i]].text, 0); + int stringWidth = GetStringWidth(FONT_NORMAL, actions[actionIds[i]].text, 0); if (stringWidth > maxWidth) maxWidth = stringWidth; } diff --git a/src/item_menu.c b/src/item_menu.c index 720c6f398..470757f8d 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -260,7 +260,7 @@ static const struct ListMenuTemplate sItemListMenu = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 7, + .fontId = FONT_NARROW, .cursorKind = 0 }; @@ -973,16 +973,16 @@ static void BagMenu_ItemPrintCallback(u8 windowId, u32 itemIndex, u8 y) // Print berry quantity ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, BERRY_CAPACITY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_xVar1); - offset = GetStringRightAlignXOffset(7, gStringVar4, 119); - BagMenu_Print(windowId, 7, gStringVar4, offset, y, 0, 0, TEXT_SPEED_FF, COLORID_NORMAL); + offset = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 119); + BagMenu_Print(windowId, FONT_NARROW, gStringVar4, offset, y, 0, 0, TEXT_SPEED_FF, COLORID_NORMAL); } else if (gBagPosition.pocket != KEYITEMS_POCKET && ItemId_GetImportance(itemId) == FALSE) { // Print item quantity ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, BAG_ITEM_CAPACITY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_xVar1); - offset = GetStringRightAlignXOffset(7, gStringVar4, 119); - BagMenu_Print(windowId, 7, gStringVar4, offset, y, 0, 0, TEXT_SPEED_FF, COLORID_NORMAL); + offset = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 119); + BagMenu_Print(windowId, FONT_NARROW, gStringVar4, offset, y, 0, 0, TEXT_SPEED_FF, COLORID_NORMAL); } else { @@ -1008,7 +1008,7 @@ static void PrintItemDescription(int itemIndex) str = gStringVar4; } FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, str, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, str, 3, 1, 0, 0, 0, COLORID_NORMAL); } static void BagMenu_PrintCursor(u8 listTaskId, u8 colorIndex) @@ -1019,9 +1019,9 @@ static void BagMenu_PrintCursor(u8 listTaskId, u8 colorIndex) static void BagMenu_PrintCursorAtPos(u8 y, u8 colorIndex) { if (colorIndex == COLORID_NONE) - FillWindowPixelRect(WIN_ITEM_LIST, PIXEL_FILL(0), 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1)); + FillWindowPixelRect(WIN_ITEM_LIST, PIXEL_FILL(0), 0, y, GetMenuCursorDimensionByFont(FONT_NORMAL, 0), GetMenuCursorDimensionByFont(FONT_NORMAL, 1)); else - BagMenu_Print(WIN_ITEM_LIST, 1, gText_SelectorArrow2, 0, y, 0, 0, 0, colorIndex); + BagMenu_Print(WIN_ITEM_LIST, FONT_NORMAL, gText_SelectorArrow2, 0, y, 0, 0, 0, colorIndex); } @@ -1195,7 +1195,7 @@ static void PrintItemQuantity(u8 windowId, s16 quantity) u8 numDigits = (gBagPosition.pocket == BERRIES_POCKET) ? BERRY_CAPACITY_DIGITS : BAG_ITEM_CAPACITY_DIGITS; ConvertIntToDecimalStringN(gStringVar1, quantity, STR_CONV_MODE_LEADING_ZEROS, numDigits); StringExpandPlaceholders(gStringVar4, gText_xVar1); - AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 0x28), 2, 0, 0); } // Prints the quantity of items to be sold and the amount that would be earned @@ -1204,7 +1204,7 @@ static void PrintItemSoldAmount(int windowId, int numSold, int moneyEarned) u8 numDigits = (gBagPosition.pocket == BERRIES_POCKET) ? BERRY_CAPACITY_DIGITS : BAG_ITEM_CAPACITY_DIGITS; ConvertIntToDecimalStringN(gStringVar1, numSold, STR_CONV_MODE_LEADING_ZEROS, numDigits); StringExpandPlaceholders(gStringVar4, gText_xVar1); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, 0); PrintMoneyAmount(windowId, 38, 1, moneyEarned, 0); } @@ -1438,7 +1438,7 @@ static void StartItemSwap(u8 taskId) CopyItemName(BagGetItemIdByPocketPosition(gBagPosition.pocket + 1, tListPosition), gStringVar1); StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); UpdateItemMenuSwapLinePos(tListPosition); DestroyPocketSwitchArrowPair(); BagMenu_PrintCursor(tListTaskId, COLORID_GRAY_CURSOR); @@ -1653,7 +1653,7 @@ static void OpenContextMenu(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); } if (gBagMenu->contextMenuNumItems == 1) PrintContextMenuItems(BagMenu_AddWindow(ITEMWIN_1x1)); @@ -1667,13 +1667,13 @@ static void OpenContextMenu(u8 taskId) static void PrintContextMenuItems(u8 windowId) { - AddItemMenuActionTextPrinters(windowId, 7, 8, 1, 0, 16, gBagMenu->contextMenuNumItems, sItemMenuActions, gBagMenu->contextMenuItemsPtr); + AddItemMenuActionTextPrinters(windowId, FONT_NARROW, 8, 1, 0, 16, gBagMenu->contextMenuNumItems, sItemMenuActions, gBagMenu->contextMenuItemsPtr); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, gBagMenu->contextMenuNumItems, 0); } static void PrintContextMenuItemGrid(u8 windowId, u8 columns, u8 rows) { - PrintMenuActionGrid(windowId, 7, 8, 1, 56, columns, rows, sItemMenuActions, gBagMenu->contextMenuItemsPtr); + PrintMenuActionGrid(windowId, FONT_NARROW, 8, 1, 56, columns, rows, sItemMenuActions, gBagMenu->contextMenuItemsPtr); InitMenuActionGrid(windowId, 56, columns, rows, 0); } @@ -1819,7 +1819,7 @@ static void ItemMenu_Toss(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); AddItemQuantityWindow(ITEMWIN_QUANTITY); gTasks[taskId].func = Task_ChooseHowManyToToss; } @@ -1833,7 +1833,7 @@ static void AskTossItems(u8 taskId) ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); BagMenu_YesNo(taskId, ITEMWIN_YESNO_LOW, &sYesNoTossFunctions); } @@ -1876,7 +1876,7 @@ static void ConfirmToss(u8 taskId) ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); gTasks[taskId].func = Task_RemoveItemFromBag; } @@ -1924,7 +1924,7 @@ static void ItemMenu_Give(u8 taskId) RemoveContextWindow(); if (!IsWritingMailAllowed(gSpecialVar_ItemId)) { - DisplayItemMessage(taskId, 1, gText_CantWriteMail, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_CantWriteMail, HandleErrorMessage); } else if (!ItemId_GetImportance(gSpecialVar_ItemId)) { @@ -1946,14 +1946,14 @@ static void ItemMenu_Give(u8 taskId) static void PrintThereIsNoPokemon(u8 taskId) { - DisplayItemMessage(taskId, 1, gText_NoPokemon, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_NoPokemon, HandleErrorMessage); } static void PrintItemCantBeHeld(u8 taskId) { CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_Var1CantBeHeld); - DisplayItemMessage(taskId, 1, gStringVar4, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, HandleErrorMessage); } static void HandleErrorMessage(u8 taskId) @@ -2001,13 +2001,13 @@ static void Task_ItemContext_GiveToParty(u8 taskId) { if (!IsWritingMailAllowed(gSpecialVar_ItemId)) { - DisplayItemMessage(taskId, 1, gText_CantWriteMail, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_CantWriteMail, HandleErrorMessage); } else if (!IsHoldingItemAllowed(gSpecialVar_ItemId)) { CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_Var1CantBeHeldHere); - DisplayItemMessage(taskId, 1, gStringVar4, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, HandleErrorMessage); } else if (gBagPosition.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId)) { @@ -2023,7 +2023,7 @@ static void Task_ItemContext_GiveToParty(u8 taskId) static void Task_ItemContext_GiveToPC(u8 taskId) { if (ItemIsMail(gSpecialVar_ItemId) == TRUE) - DisplayItemMessage(taskId, 1, gText_CantWriteMail, HandleErrorMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_CantWriteMail, HandleErrorMessage); else if (gBagPosition.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId)) gTasks[taskId].func = Task_FadeAndCloseBagMenu; else @@ -2072,7 +2072,7 @@ static void Task_ItemContext_Sell(u8 taskId) { CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_CantBuyKeyItem); - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); } else { @@ -2086,7 +2086,7 @@ static void Task_ItemContext_Sell(u8 taskId) { CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_HowManyToSell); - DisplayItemMessage(taskId, 1, gStringVar4, InitSellHowManyInput); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, InitSellHowManyInput); } } } @@ -2097,7 +2097,7 @@ static void DisplaySellItemPriceAndConfirm(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1); - DisplayItemMessage(taskId, 1, gStringVar4, AskSellItems); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, AskSellItems); } static void AskSellItems(u8 taskId) @@ -2157,7 +2157,7 @@ static void ConfirmSell(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar2); ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2); - DisplayItemMessage(taskId, 1, gStringVar4, SellItem); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, SellItem); } static void SellItem(u8 taskId) @@ -2203,7 +2203,7 @@ static void Task_ItemContext_Deposit(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_DepositHowManyVar1); FillWindowPixelBuffer(WIN_DESCRIPTION, PIXEL_FILL(0)); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); AddItemQuantityWindow(ITEMWIN_QUANTITY); gTasks[taskId].func = Task_ChooseHowManyToDeposit; } @@ -2241,7 +2241,7 @@ static void TryDepositItem(u8 taskId) if (ItemId_GetImportance(gSpecialVar_ItemId)) { // Can't deposit important items - BagMenu_Print(WIN_DESCRIPTION, 1, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, COLORID_NORMAL); gTasks[taskId].func = WaitDepositErrorMessage; } else if (AddPCItem(gSpecialVar_ItemId, tItemCount) == TRUE) @@ -2250,13 +2250,13 @@ static void TryDepositItem(u8 taskId) CopyItemName(gSpecialVar_ItemId, gStringVar1); ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s); - BagMenu_Print(WIN_DESCRIPTION, 1, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gStringVar4, 3, 1, 0, 0, 0, COLORID_NORMAL); gTasks[taskId].func = Task_RemoveItemFromBag; } else { // No room to deposit - BagMenu_Print(WIN_DESCRIPTION, 1, gText_NoRoomForItems, 3, 1, 0, 0, 0, COLORID_NORMAL); + BagMenu_Print(WIN_DESCRIPTION, FONT_NORMAL, gText_NoRoomForItems, 3, 1, 0, 0, 0, COLORID_NORMAL); gTasks[taskId].func = WaitDepositErrorMessage; } } @@ -2416,12 +2416,12 @@ static void PrintPocketNames(const u8 *pocketName1, const u8 *pocketName2) window.height = 2; windowId = AddWindow(&window); FillWindowPixelBuffer(windowId, PIXEL_FILL(0)); - offset = GetStringCenterAlignXOffset(1, pocketName1, 0x40); - BagMenu_Print(windowId, 1, pocketName1, offset, 1, 0, 0, TEXT_SPEED_FF, COLORID_POCKET_NAME); + offset = GetStringCenterAlignXOffset(FONT_NORMAL, pocketName1, 0x40); + BagMenu_Print(windowId, FONT_NORMAL, pocketName1, offset, 1, 0, 0, TEXT_SPEED_FF, COLORID_POCKET_NAME); if (pocketName2) { - offset = GetStringCenterAlignXOffset(1, pocketName2, 0x40); - BagMenu_Print(windowId, 1, pocketName2, offset + 0x40, 1, 0, 0, TEXT_SPEED_FF, COLORID_POCKET_NAME); + offset = GetStringCenterAlignXOffset(FONT_NORMAL, pocketName2, 0x40); + BagMenu_Print(windowId, FONT_NORMAL, pocketName2, offset + 0x40, 1, 0, 0, TEXT_SPEED_FF, COLORID_POCKET_NAME); } CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gBagMenu->pocketNameBuffer, sizeof(gBagMenu->pocketNameBuffer)); RemoveWindow(windowId); @@ -2557,7 +2557,7 @@ static void PrintTMHMMoveData(u16 itemId) if (itemId == ITEM_NONE) { for (i = 0; i < 4; i++) - BagMenu_Print(WIN_TMHM_INFO, 1, gText_ThreeDashes, 7, i * 12, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); + BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, gText_ThreeDashes, 7, i * 12, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); CopyWindowToVram(WIN_TMHM_INFO, 2); } else @@ -2575,7 +2575,7 @@ static void PrintTMHMMoveData(u16 itemId) ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].power, STR_CONV_MODE_RIGHT_ALIGN, 3); text = gStringVar1; } - BagMenu_Print(WIN_TMHM_INFO, 1, text, 7, 12, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); + BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, text, 7, 12, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); // Print TMHM accuracy if (gBattleMoves[moveId].accuracy == 0) @@ -2587,11 +2587,11 @@ static void PrintTMHMMoveData(u16 itemId) ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].accuracy, STR_CONV_MODE_RIGHT_ALIGN, 3); text = gStringVar1; } - BagMenu_Print(WIN_TMHM_INFO, 1, text, 7, 24, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); + BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, text, 7, 24, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); // Print TMHM pp ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].pp, STR_CONV_MODE_RIGHT_ALIGN, 3); - BagMenu_Print(WIN_TMHM_INFO, 1, gStringVar1, 7, 36, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); + BagMenu_Print(WIN_TMHM_INFO, FONT_NORMAL, gStringVar1, 7, 36, 0, 0, TEXT_SPEED_FF, COLORID_TMHM_INFO); CopyWindowToVram(WIN_TMHM_INFO, 2); } diff --git a/src/item_use.c b/src/item_use.c index cee451f36..29ceb7cae 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -143,7 +143,7 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte if (!isUsingRegisteredKeyItemOnField) { if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); } @@ -651,7 +651,7 @@ void ItemUseOutOfBattle_CoinCase(u8 taskId) if (!gTasks[taskId].tUsingRegisteredKeyItem) { - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); } else { @@ -666,7 +666,7 @@ void ItemUseOutOfBattle_PowderJar(u8 taskId) if (!gTasks[taskId].tUsingRegisteredKeyItem) { - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); } else { @@ -782,9 +782,9 @@ void ItemUseOutOfBattle_RareCandy(u8 taskId) void ItemUseOutOfBattle_TMHM(u8 taskId) { if (gSpecialVar_ItemId >= ITEM_HM01_CUT) - DisplayItemMessage(taskId, 1, gText_BootedUpHM, BootUpSoundTMHM); // HM + DisplayItemMessage(taskId, FONT_NORMAL, gText_BootedUpHM, BootUpSoundTMHM); // HM else - DisplayItemMessage(taskId, 1, gText_BootedUpTM, BootUpSoundTMHM); // TM + DisplayItemMessage(taskId, FONT_NORMAL, gText_BootedUpTM, BootUpSoundTMHM); // TM } static void BootUpSoundTMHM(u8 taskId) @@ -799,7 +799,7 @@ static void Task_ShowTMHMContainedMessage(u8 taskId) { StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]); StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1); - DisplayItemMessage(taskId, 1, gStringVar4, UseTMHMYesNo); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, UseTMHMYesNo); } } @@ -836,7 +836,7 @@ void ItemUseOutOfBattle_Repel(u8 taskId) if (VarGet(VAR_REPEL_STEP_COUNT) == 0) gTasks[taskId].func = Task_StartUseRepel; else if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gText_RepelEffectsLingered, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage); } @@ -860,7 +860,7 @@ static void Task_UseRepel(u8 taskId) VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId)); RemoveUsedItem(); if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); } @@ -872,7 +872,7 @@ static void Task_UsedBlackWhiteFlute(u8 taskId) { PlaySE(SE_GLASS_FLUTE); if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gStringVar4, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); } @@ -951,7 +951,7 @@ void ItemUseInBattle_PokeBall(u8 taskId) } else if (!InBattlePyramid()) { - DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_BoxFull, CloseItemMessage); } else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); @@ -975,7 +975,7 @@ static void Task_UseStatIncreaseItem(u8 taskId) PlaySE(SE_USE_ITEM); RemoveBagItem(gSpecialVar_ItemId, 1); if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage); + DisplayItemMessage(taskId, FONT_NORMAL, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage); else DisplayItemMessageInBattlePyramid(taskId, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage); } @@ -989,7 +989,7 @@ void ItemUseInBattle_StatIncrease(u8 taskId) if (ExecuteTableBasedItemEffect(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) { if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gText_WontHaveEffect, CloseItemMessage); + DisplayItemMessage(taskId, FONT_NORMAL, gText_WontHaveEffect, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, Task_CloseBattlePyramidBagMessage); } @@ -1041,7 +1041,7 @@ void ItemUseInBattle_Escape(u8 taskId) { RemoveUsedItem(); if (!InBattlePyramid()) - DisplayItemMessage(taskId, 1, gStringVar4, Task_FadeAndCloseBagMenu); + DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, Task_FadeAndCloseBagMenu); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, CloseBattlePyramidBag); } diff --git a/src/link.c b/src/link.c index f5eb8b68c..5aee79d9b 100644 --- a/src/link.c +++ b/src/link.c @@ -1644,8 +1644,8 @@ static void ErrorMsg_MoveCloserToPartner(void) LoadPalette(sWirelessLinkDisplayPal, 0, 0x20); FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(2, PIXEL_FILL(0)); - AddTextPrinterParameterized3(0, 3, 2, 6, sTextColors, 0, gText_CommErrorEllipsis); - AddTextPrinterParameterized3(2, 3, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner); + AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis); + AddTextPrinterParameterized3(2, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner); PutWindowTilemap(0); PutWindowTilemap(2); CopyWindowToVram(0, 0); @@ -1657,7 +1657,7 @@ static void ErrorMsg_CheckConnections(void) LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0); FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(2, PIXEL_FILL(0)); - AddTextPrinterParameterized3(1, 3, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); + AddTextPrinterParameterized3(1, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); PutWindowTilemap(1); PutWindowTilemap(2); CopyWindowToVram(1, 0); @@ -1692,9 +1692,9 @@ static void CB2_PrintErrorMessage(void) break; case 130: if (gWirelessCommType == 2) - AddTextPrinterParameterized3(0, 3, 2, 20, sTextColors, 0, gText_ABtnTitleScreen); + AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnTitleScreen); else if (gWirelessCommType == 1) - AddTextPrinterParameterized3(0, 3, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter); + AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter); break; } if (gMain.state == 160) diff --git a/src/mail.c b/src/mail.c index 1cbfd8baa..f1350c4e1 100644 --- a/src/mail.c +++ b/src/mail.c @@ -690,14 +690,14 @@ static void PrintMailText(void) if (sMailRead->message[i][0] == EOS || sMailRead->message[i][0] == CHAR_SPACE) continue; - AddTextPrinterParameterized3(0, 1, sMailRead->layout->lines[i].xOffset + sMailRead->layout->wordsXPos, y + sMailRead->layout->wordsYPos, sTextColors, 0, sMailRead->message[i]); + AddTextPrinterParameterized3(0, FONT_NORMAL, sMailRead->layout->lines[i].xOffset + sMailRead->layout->wordsXPos, y + sMailRead->layout->wordsYPos, sTextColors, 0, sMailRead->message[i]); y += sMailRead->layout->lines[i].height; } bufptr = StringCopy(signature, gText_FromSpace); StringCopy(bufptr, sMailRead->playerName); - box_x = GetStringCenterAlignXOffset(1, signature, sMailRead->signatureWidth) + 104; + box_x = GetStringCenterAlignXOffset(FONT_NORMAL, signature, sMailRead->signatureWidth) + 104; box_y = sMailRead->layout->signatureYPos + 88; - AddTextPrinterParameterized3(0, 1, box_x, box_y, sTextColors, 0, signature); + AddTextPrinterParameterized3(0, FONT_NORMAL, box_x, box_y, sTextColors, 0, signature); CopyWindowToVram(0, 3); CopyWindowToVram(1, 3); } diff --git a/src/main_menu.c b/src/main_menu.c index b2879968c..637719dea 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -780,8 +780,8 @@ static void Task_DisplayMainMenu(u8 taskId) default: FillWindowPixelBuffer(0, PIXEL_FILL(0xA)); FillWindowPixelBuffer(1, PIXEL_FILL(0xA)); - AddTextPrinterParameterized3(0, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); - AddTextPrinterParameterized3(1, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); + AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); PutWindowTilemap(0); PutWindowTilemap(1); CopyWindowToVram(0, 2); @@ -793,9 +793,9 @@ static void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(2, PIXEL_FILL(0xA)); FillWindowPixelBuffer(3, PIXEL_FILL(0xA)); FillWindowPixelBuffer(4, PIXEL_FILL(0xA)); - AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); - AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); - AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); + AddTextPrinterParameterized3(3, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); + AddTextPrinterParameterized3(4, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); MainMenu_FormatSavegameText(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -812,10 +812,10 @@ static void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(3, PIXEL_FILL(0xA)); FillWindowPixelBuffer(4, PIXEL_FILL(0xA)); FillWindowPixelBuffer(5, PIXEL_FILL(0xA)); - AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); - AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); - AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift); - AddTextPrinterParameterized3(5, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); + AddTextPrinterParameterized3(3, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); + AddTextPrinterParameterized3(4, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift); + AddTextPrinterParameterized3(5, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); MainMenu_FormatSavegameText(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -836,11 +836,11 @@ static void Task_DisplayMainMenu(u8 taskId) FillWindowPixelBuffer(4, PIXEL_FILL(0xA)); FillWindowPixelBuffer(5, PIXEL_FILL(0xA)); FillWindowPixelBuffer(6, PIXEL_FILL(0xA)); - AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); - AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); - AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift2); - AddTextPrinterParameterized3(5, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryEvents); - AddTextPrinterParameterized3(6, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue); + AddTextPrinterParameterized3(3, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame); + AddTextPrinterParameterized3(4, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift2); + AddTextPrinterParameterized3(5, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryEvents); + AddTextPrinterParameterized3(6, FONT_NORMAL, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption); MainMenu_FormatSavegameText(); PutWindowTilemap(2); PutWindowTilemap(3); @@ -2117,7 +2117,7 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) static void CreateMainMenuErrorWindow(const u8* str) { FillWindowPixelBuffer(7, PIXEL_FILL(1)); - AddTextPrinterParameterized(7, 1, str, 0, 1, 2, 0); + AddTextPrinterParameterized(7, FONT_NORMAL, str, 0, 1, 2, 0); PutWindowTilemap(7); CopyWindowToVram(7, 2); DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[7], MAIN_MENU_BORDER_TILE); @@ -2136,8 +2136,8 @@ static void MainMenu_FormatSavegameText(void) static void MainMenu_FormatSavegamePlayer(void) { StringExpandPlaceholders(gStringVar4, gText_ContinueMenuPlayer); - AddTextPrinterParameterized3(2, 1, 0, 17, sTextColor_MenuInfo, -1, gStringVar4); - AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, gSaveBlock2Ptr->playerName, 100), 17, sTextColor_MenuInfo, -1, gSaveBlock2Ptr->playerName); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0, 17, sTextColor_MenuInfo, -1, gStringVar4); + AddTextPrinterParameterized3(2, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, gSaveBlock2Ptr->playerName, 100), 17, sTextColor_MenuInfo, -1, gSaveBlock2Ptr->playerName); } static void MainMenu_FormatSavegameTime(void) @@ -2146,11 +2146,11 @@ static void MainMenu_FormatSavegameTime(void) u8* ptr; StringExpandPlaceholders(gStringVar4, gText_ContinueMenuTime); - AddTextPrinterParameterized3(2, 1, 0x6C, 17, sTextColor_MenuInfo, -1, gStringVar4); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0x6C, 17, sTextColor_MenuInfo, -1, gStringVar4); ptr = ConvertIntToDecimalStringN(str, gSaveBlock2Ptr->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3); *ptr = 0xF0; ConvertIntToDecimalStringN(ptr + 1, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2); - AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 0xD0), 17, sTextColor_MenuInfo, -1, str); + AddTextPrinterParameterized3(2, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, str, 0xD0), 17, sTextColor_MenuInfo, -1, str); } static void MainMenu_FormatSavegamePokedex(void) @@ -2165,9 +2165,9 @@ static void MainMenu_FormatSavegamePokedex(void) else dexCount = GetHoennPokedexCount(FLAG_GET_CAUGHT); StringExpandPlaceholders(gStringVar4, gText_ContinueMenuPokedex); - AddTextPrinterParameterized3(2, 1, 0, 33, sTextColor_MenuInfo, -1, gStringVar4); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0, 33, sTextColor_MenuInfo, -1, gStringVar4); ConvertIntToDecimalStringN(str, dexCount, STR_CONV_MODE_LEFT_ALIGN, 3); - AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 100), 33, sTextColor_MenuInfo, -1, str); + AddTextPrinterParameterized3(2, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, str, 100), 33, sTextColor_MenuInfo, -1, str); } } @@ -2183,9 +2183,9 @@ static void MainMenu_FormatSavegameBadges(void) badgeCount++; } StringExpandPlaceholders(gStringVar4, gText_ContinueMenuBadges); - AddTextPrinterParameterized3(2, 1, 0x6C, 33, sTextColor_MenuInfo, -1, gStringVar4); + AddTextPrinterParameterized3(2, FONT_NORMAL, 0x6C, 33, sTextColor_MenuInfo, -1, gStringVar4); ConvertIntToDecimalStringN(str, badgeCount, STR_CONV_MODE_LEADING_ZEROS, 1); - AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 0xD0), 33, sTextColor_MenuInfo, -1, str); + AddTextPrinterParameterized3(2, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, str, 0xD0), 33, sTextColor_MenuInfo, -1, str); } static void LoadMainMenuWindowFrameTiles(u8 bgId, u16 tileOffset) @@ -2237,9 +2237,9 @@ static void NewGameBirchSpeech_ClearGenderWindow(u8 windowId, bool8 copyToVram) static void NewGameBirchSpeech_ClearWindow(u8 windowId) { - u8 bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND); - u8 maxCharWidth = GetFontAttribute(1, FONTATTR_MAX_LETTER_WIDTH); - u8 maxCharHeight = GetFontAttribute(1, FONTATTR_MAX_LETTER_HEIGHT); + u8 bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND); + u8 maxCharWidth = GetFontAttribute(FONT_NORMAL, FONTATTR_MAX_LETTER_WIDTH); + u8 maxCharHeight = GetFontAttribute(FONT_NORMAL, FONTATTR_MAX_LETTER_HEIGHT); u8 winWidth = GetWindowAttribute(windowId, WINDOW_WIDTH); u8 winHeight = GetWindowAttribute(windowId, WINDOW_HEIGHT); diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 97b02acf6..88a06eed4 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -325,11 +325,11 @@ static void ShowMapNamePopUpWindow(void) } AddMapNamePopUpWindow(); LoadMapNamePopUpWindowBg(); - x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80); + x = GetStringCenterAlignXOffset(FONT_NARROW, withoutPrefixPtr, 80); mapDisplayHeader[0] = EXT_CTRL_CODE_BEGIN; mapDisplayHeader[1] = EXT_CTRL_CODE_HIGHLIGHT; mapDisplayHeader[2] = TEXT_COLOR_TRANSPARENT; - AddTextPrinterParameterized(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL); + AddTextPrinterParameterized(GetMapNamePopUpWindowId(), FONT_NARROW, mapDisplayHeader, x, 3, 0xFF, NULL); CopyWindowToVram(GetMapNamePopUpWindowId(), 3); } diff --git a/src/match_call.c b/src/match_call.c index 9939b09d2..4c77b8764 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1401,7 +1401,7 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str) struct TextPrinterTemplate printerTemplate; printerTemplate.currentChar = str; printerTemplate.windowId = windowId; - printerTemplate.fontId = 1; + printerTemplate.fontId = FONT_NORMAL; printerTemplate.x = 32; printerTemplate.y = 1; printerTemplate.currentX = 32; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 2fd0e6730..a9f7df744 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -447,7 +447,7 @@ static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 a1) static void DrawSongTextWindow(const u8 * str) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, str, 0, 1, 1, DisableTextPrinters); + AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters); gDisableTextPrinters = TRUE; CopyWindowToVram(0, 3); } @@ -1324,7 +1324,7 @@ static void StorytellerDisplayStory(u32 player) static void PrintStoryList(void) { s32 i; - s32 width = GetStringWidth(1, gText_Exit, 0); + s32 width = GetStringWidth(FONT_NORMAL, gText_Exit, 0); for (i = 0; i < NUM_STORYTELLER_TALES; i++) { s32 curWidth; @@ -1332,7 +1332,7 @@ static void PrintStoryList(void) if (gameStatID == 0) break; - curWidth = GetStringWidth(1, GetStoryTitleByStat(gameStatID), 0); + curWidth = GetStringWidth(FONT_NORMAL, GetStoryTitleByStat(gameStatID), 0); if (curWidth > width) width = curWidth; } @@ -1343,9 +1343,9 @@ static void PrintStoryList(void) u16 gameStatID = sStorytellerPtr->gameStatIDs[i]; if (gameStatID == 0) break; - AddTextPrinterParameterized(sStorytellerWindowId, 1, GetStoryTitleByStat(gameStatID), 8, 16 * i + 1, 0xFF, NULL); + AddTextPrinterParameterized(sStorytellerWindowId, FONT_NORMAL, GetStoryTitleByStat(gameStatID), 8, 16 * i + 1, 0xFF, NULL); } - AddTextPrinterParameterized(sStorytellerWindowId, 1, gText_Exit, 8, 16 * i + 1, 0xFF, NULL); + AddTextPrinterParameterized(sStorytellerWindowId, FONT_NORMAL, gText_Exit, 8, 16 * i + 1, 0xFF, NULL); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sStorytellerWindowId, GetFreeStorySlot() + 1, 0); CopyWindowToVram(sStorytellerWindowId, 3); } diff --git a/src/menu.c b/src/menu.c index 117642098..b8f09063d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -193,19 +193,19 @@ void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress) { void (*callback)(struct TextPrinterTemplate *, u16) = NULL; gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); } void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress) { gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3); } void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed) { gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress; - AddTextPrinterParameterized2(0, 1, gStringVar4, speed, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, speed, NULL, 2, 1, 3); } void LoadMessageBoxAndBorderGfx(void) @@ -460,7 +460,7 @@ static u16 Menu_GetStdPalColor(u8 colorNum) void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback) { LoadMessageBoxAndBorderGfx(); - DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeedDelay(), string, callback); + DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, FONT_NORMAL, GetPlayerTextSpeedDelay(), string, callback); CopyWindowToVram(0, 3); } @@ -547,7 +547,7 @@ void RemoveMapNamePopUpWindow(void) void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)) { gTextFlags.canABSpeedUpPrint = a1; - AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); } void sub_8197AE8(bool8 copyToVram) @@ -823,9 +823,9 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) { PutWindowTilemap(sWindowId); FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); - width = GetStringWidth(0, string, 0); + width = GetStringWidth(FONT_SMALL, string, 0); AddTextPrinterParameterized3(sWindowId, - 0, + FONT_SMALL, 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, 1, sTextColors, @@ -859,16 +859,16 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); if (string2 != NULL) { - width = GetStringWidth(0, string2, 0); + width = GetStringWidth(FONT_SMALL, string2, 0); AddTextPrinterParameterized3(sWindowId, - 0, + FONT_SMALL, 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, 1, color, 0, string2); } - AddTextPrinterParameterized4(sWindowId, 1, 4, 1, 0, 0, color, 0, string); + AddTextPrinterParameterized4(sWindowId, FONT_NORMAL, 4, 1, 0, 0, color, 0, string); if (copyToVram) CopyWindowToVram(sWindowId, 3); } @@ -1202,7 +1202,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING); printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING); - AddTextPrinter(&printer, 0xFF, NULL); + AddTextPrinter(&printer, TEXT_SPEED_FF, NULL); sub_81983AC(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos); } @@ -1580,7 +1580,7 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo sMenu.minCursorPos = 0; sMenu.maxCursorPos = itemCount - 1; sMenu.windowId = windowId; - sMenu.fontId = 1; + sMenu.fontId = FONT_NORMAL; sMenu.optionHeight = 16; sMenu.APressMuted = APressMuted; @@ -1617,11 +1617,11 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *menuActions struct TextPrinterTemplate printer; printer.windowId = windowId; - printer.fontId = 1; - printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND); - printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND); - printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW); - printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN); + printer.fontId = FONT_NORMAL; + printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND); + printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND); + printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW); + printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN); printer.letterSpacing = 0; printer.lineSpacing = 0; printer.x = 8; @@ -1647,15 +1647,15 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa printer.currentChar = gText_YesNo; printer.windowId = sYesNoWindowId; - printer.fontId = 1; + printer.fontId = FONT_NORMAL; printer.x = 8; printer.y = 1; printer.currentX = printer.x; printer.currentY = printer.y; - printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND); - printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND); - printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW); - printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN); + printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND); + printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND); + printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW); + printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN); printer.letterSpacing = 0; printer.lineSpacing = 0; @@ -1682,11 +1682,11 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M struct TextPrinterTemplate printer; printer.windowId = windowId; - printer.fontId = 1; - printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND); - printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND); - printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW); - printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN); + printer.fontId = FONT_NORMAL; + printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND); + printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND); + printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW); + printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN); printer.letterSpacing = 0; printer.lineSpacing = 0; @@ -1715,7 +1715,7 @@ u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initi sMenu.minCursorPos = 0; sMenu.maxCursorPos = (columns * rows) - 1; sMenu.windowId = windowId; - sMenu.fontId = 1; + sMenu.fontId = FONT_NORMAL; sMenu.optionWidth = optionWidth; sMenu.optionHeight = 16; sMenu.columns = columns; @@ -1948,8 +1948,8 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const printer.y = top; printer.currentX = printer.x; printer.currentY = printer.y; - printer.letterSpacing = GetFontAttribute(fontId, 2); - printer.lineSpacing = GetFontAttribute(fontId, 3); + printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING); + printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING); printer.unk = 0; printer.fgColor = color[1]; printer.bgColor = color[0]; @@ -1994,9 +1994,9 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left printer.lineSpacing = lineSpacing; printer.unk = 0; - printer.fgColor = GetFontAttribute(fontId, 5); - printer.bgColor = GetFontAttribute(fontId, 6); - printer.shadowColor = GetFontAttribute(fontId, 7); + printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND); + printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND); + printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW); AddTextPrinter(&printer, speed, callback); } diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 1ea53a898..6e13a769f 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -203,7 +203,7 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -268,7 +268,7 @@ static void MailboxMenu_ItemPrintFunc(u8 windowId, u32 itemId, u8 y) length = StringLength(buffer); if (length < PLAYER_NAME_LENGTH - 1) ConvertInternationalString(buffer, LANGUAGE_JAPANESE); - AddTextPrinterParameterized4(windowId, 1, 8, y, 0, 0, sPlayerNameTextColors, -1, buffer); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, 8, y, 0, 0, sPlayerNameTextColors, -1, buffer); } u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page) @@ -296,7 +296,7 @@ u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page) gMultiuseListMenuTemplate.cursorShadowPal = 3; gMultiuseListMenuTemplate.moveCursorFunc = MailboxMenu_MoveCursorFunc; gMultiuseListMenuTemplate.itemPrintFunc = MailboxMenu_ItemPrintFunc; - gMultiuseListMenuTemplate.fontId = 1; + gMultiuseListMenuTemplate.fontId = FONT_NORMAL; gMultiuseListMenuTemplate.cursorKind = 0; gMultiuseListMenuTemplate.lettersSpacing = 0; gMultiuseListMenuTemplate.itemVerticalPadding = 0; @@ -739,19 +739,19 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) FillWindowPixelBuffer(0, PIXEL_FILL(1)); str = gText_MoveRelearnerBattleMoves; - x = GetStringCenterAlignXOffset(1, str, 0x80); - AddTextPrinterParameterized(0, 1, str, x, 1, TEXT_SPEED_FF, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80); + AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 1, TEXT_SPEED_FF, NULL); str = gText_MoveRelearnerPP; - AddTextPrinterParameterized(0, 1, str, 4, 0x29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x29, TEXT_SPEED_FF, NULL); str = gText_MoveRelearnerPower; - x = GetStringRightAlignXOffset(1, str, 0x6A); - AddTextPrinterParameterized(0, 1, str, x, 0x19, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A); + AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x19, TEXT_SPEED_FF, NULL); str = gText_MoveRelearnerAccuracy; - x = GetStringRightAlignXOffset(1, str, 0x6A); - AddTextPrinterParameterized(0, 1, str, x, 0x29, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A); + AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x29, TEXT_SPEED_FF, NULL); if (chosenMove == LIST_CANCEL) { CopyWindowToVram(0, 2); @@ -759,11 +759,11 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) } move = &gBattleMoves[chosenMove]; str = gTypeNames[move->type]; - AddTextPrinterParameterized(0, 1, str, 4, 0x19, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x19, TEXT_SPEED_FF, NULL); - x = 4 + GetStringWidth(1, gText_MoveRelearnerPP, 0); + x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0); ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2); - AddTextPrinterParameterized(0, 1, buffer, x, 0x29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, buffer, x, 0x29, TEXT_SPEED_FF, NULL); if (move->power < 2) { @@ -774,7 +774,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3); str = buffer; } - AddTextPrinterParameterized(0, 1, str, 0x6A, 0x19, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x19, TEXT_SPEED_FF, NULL); if (move->accuracy == 0) { @@ -785,10 +785,10 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove) ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3); str = buffer; } - AddTextPrinterParameterized(0, 1, str, 0x6A, 0x29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SPEED_FF, NULL); str = gMoveDescriptionPointers[chosenMove - 1]; - AddTextPrinterParameterized(0, 7, str, 0, 0x41, 0, NULL); + AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL); } static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove) @@ -800,16 +800,16 @@ static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove) MoveRelearnerShowHideHearts(chosenMove); FillWindowPixelBuffer(1, PIXEL_FILL(1)); str = gText_MoveRelearnerContestMovesTitle; - x = GetStringCenterAlignXOffset(1, str, 0x80); - AddTextPrinterParameterized(1, 1, str, x, 1, TEXT_SPEED_FF, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80); + AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 1, TEXT_SPEED_FF, NULL); str = gText_MoveRelearnerAppeal; - x = GetStringRightAlignXOffset(1, str, 0x5C); - AddTextPrinterParameterized(1, 1, str, x, 0x19, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C); + AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x19, TEXT_SPEED_FF, NULL); str = gText_MoveRelearnerJam; - x = GetStringRightAlignXOffset(1, str, 0x5C); - AddTextPrinterParameterized(1, 1, str, x, 0x29, TEXT_SPEED_FF, NULL); + x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C); + AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x29, TEXT_SPEED_FF, NULL); if (chosenMove == MENU_NOTHING_CHOSEN) { @@ -819,10 +819,10 @@ static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove) move = &gContestMoves[chosenMove]; str = gContestMoveTypeTextPointers[move->contestCategory]; - AddTextPrinterParameterized(1, 1, str, 4, 0x19, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, str, 4, 0x19, TEXT_SPEED_FF, NULL); str = gContestEffectDescriptionPointers[move->effect]; - AddTextPrinterParameterized(1, 7, str, 0, 0x41, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(1, FONT_NARROW, str, 0, 0x41, TEXT_SPEED_FF, NULL); CopyWindowToVram(1, 2); } @@ -842,7 +842,7 @@ void MoveRelearnerPrintText(u8 *str) FillWindowPixelBuffer(3, PIXEL_FILL(1)); gTextFlags.canABSpeedUpPrint = TRUE; speed = GetPlayerTextSpeedDelay(); - AddTextPrinterParameterized2(3, 1, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3); + AddTextPrinterParameterized2(3, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3); } bool16 MoveRelearnerRunTextPrinters(void) @@ -1512,7 +1512,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg { AddTextPrinterParameterized3(windowId, - 1, + FONT_NORMAL, 0, 15 * i, color, @@ -1521,7 +1521,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg StringCopy(text, (statsDiff[i] >= 0) ? gText_Plus : gText_Dash); AddTextPrinterParameterized3(windowId, - 1, + FONT_NORMAL, 56, 15 * i, color, @@ -1534,7 +1534,7 @@ void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bg ConvertIntToDecimalStringN(text, abs(statsDiff[i]), STR_CONV_MODE_LEFT_ALIGN, 2); AddTextPrinterParameterized3(windowId, - 1, + FONT_NORMAL, 56 + x, 15 * i, color, @@ -1576,7 +1576,7 @@ void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 s x = 6 * (4 - numDigits); AddTextPrinterParameterized3(windowId, - 1, + FONT_NORMAL, 0, 15 * i, color, @@ -1584,7 +1584,7 @@ void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 s sLvlUpStatStrings[i]); AddTextPrinterParameterized3(windowId, - 1, + FONT_NORMAL, 56 + x, 15 * i, color, diff --git a/src/money.c b/src/money.c index 6213f2dd0..db571939a 100644 --- a/src/money.c +++ b/src/money.c @@ -149,7 +149,7 @@ void PrintMoneyAmount(u8 windowId, u8 x, u8 y, int amount, u8 speed) *(txtPtr++) = 0x77; StringExpandPlaceholders(txtPtr, gText_PokedollarVar1); - AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, speed, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, x, y, speed, NULL); } void PrintMoneyAmountInMoneyBoxWithBorder(u8 windowId, u16 tileStart, u8 pallete, int amount) diff --git a/src/move_relearner.c b/src/move_relearner.c index 1fa947eba..554f84fe9 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -766,7 +766,7 @@ static void HideHeartSpritesAndShowTeachMoveText(bool8 onlyHideSprites) { StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn); FillWindowPixelBuffer(3, 0x11); - AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL); + AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL); } } @@ -836,7 +836,7 @@ static void ShowTeachMoveText(bool8 shouldDoNothingInstead) { StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn); FillWindowPixelBuffer(3, 0x11); - AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL); + AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL); } } diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index f6c07acd1..4467dd52e 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -312,5 +312,5 @@ static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 sp textColor[2] = 3; FillWindowPixelBuffer(windowId, PIXEL_FILL(textColor[0])); - AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, textColor, speed, text); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, lineSpacing, textColor, speed, text); } diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c index 709aa28c0..a00761f96 100644 --- a/src/mystery_gift_menu.c +++ b/src/mystery_gift_menu.c @@ -235,7 +235,7 @@ static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = { .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -280,7 +280,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSendToss = { .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -301,7 +301,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveToss = { .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -322,7 +322,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSend = { .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -343,7 +343,7 @@ static const struct ListMenuTemplate sListMenu_Receive = { .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = 0, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0 }; @@ -490,8 +490,8 @@ void PrintMysteryGiftOrEReaderTopMenu(bool8 isEReader, bool32 useCancel) options = gJPText_DecideStop; } - AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, sTextColors_TopMenu, TEXT_SPEED_FF, header); - AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, sTextColors_TopMenu, TEXT_SPEED_FF, options); + AddTextPrinterParameterized4(0, FONT_NORMAL, 4, 1, 0, 0, sTextColors_TopMenu, TEXT_SPEED_FF, header); + AddTextPrinterParameterized4(0, FONT_SMALL, GetStringRightAlignXOffset(FONT_SMALL, options, 0xDE), 1, 0, 0, sTextColors_TopMenu, TEXT_SPEED_FF, options); CopyWindowToVram(0, 2); PutWindowTilemap(0); } @@ -537,7 +537,7 @@ void AddTextPrinterToWindow1(const u8 *str) { StringExpandPlaceholders(gStringVar4, str); FillWindowPixelBuffer(1, 0x11); - AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + AddTextPrinterParameterized4(1, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); DrawTextBorderOuter(1, 0x001, 0xF); PutWindowTilemap(1); CopyWindowToVram(1, 3); @@ -669,7 +669,7 @@ s8 DoMysteryGiftYesNo(u8 * textState, u16 * windowId, bool8 yesNoBoxPlacement, c else *windowId = AddWindow(&sWindowTemplate_YesNoMsg); FillWindowPixelBuffer(*windowId, 0x11); - AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + AddTextPrinterParameterized4(*windowId, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); DrawTextBorderOuter(*windowId, 0x001, 0x0F); CopyWindowToVram(*windowId, 2); PutWindowTilemap(*windowId); @@ -726,7 +726,7 @@ static s32 HandleGiftSelectMenu(u8 * textState, u16 * windowId, bool32 cannotTos StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithNews); *windowId = AddWindow(&sWindowTemplate_GiftSelect); FillWindowPixelBuffer(*windowId, 0x11); - AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + AddTextPrinterParameterized4(*windowId, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); DrawTextBorderOuter(*windowId, 0x001, 0x0F); CopyWindowToVram(*windowId, 2); PutWindowTilemap(*windowId); diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index 0e1c11520..400367b92 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -424,25 +424,25 @@ static void DrawCardWindow(u8 whichWindow) { // Print card title/subtitle s32 x; - AddTextPrinterParameterized3(windowId, 3, 0, 1, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->titleText); - x = 160 - GetStringWidth(3, sWonderCardData->subtitleText, GetFontAttribute(3, FONTATTR_LETTER_SPACING)); + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, 0, 1, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->titleText); + x = 160 - GetStringWidth(FONT_SHORT_COPY_1, sWonderCardData->subtitleText, GetFontAttribute(FONT_SHORT_COPY_1, FONTATTR_LETTER_SPACING)); if (x < 0) x = 0; - AddTextPrinterParameterized3(windowId, 3, x, 17, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->subtitleText); + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, x, 17, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->subtitleText); // Print id number if (sWonderCardData->card.idNumber != 0) - AddTextPrinterParameterized3(windowId, 1, 166, 17, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->idNumberText); + AddTextPrinterParameterized3(windowId, FONT_NORMAL, 166, 17, sCard_TextColorTable[sWonderCardData->gfx->titleTextPal], 0, sWonderCardData->idNumberText); break; } case CARD_WIN_BODY: // Print body text for (; i < WONDER_CARD_BODY_TEXT_LINES; i++) - AddTextPrinterParameterized3(windowId, 3, 0, 16 * i + 2, sCard_TextColorTable[sWonderCardData->gfx->bodyTextPal], 0, sWonderCardData->bodyText[i]); + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, 0, 16 * i + 2, sCard_TextColorTable[sWonderCardData->gfx->bodyTextPal], 0, sWonderCardData->bodyText[i]); break; case CARD_WIN_FOOTER: // Print footer line 1 - AddTextPrinterParameterized3(windowId, 3, 0, + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, 0, sCard_FooterTextOffsets[sWonderCardData->card.type], sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->footerLine1Text); @@ -452,7 +452,7 @@ static void DrawCardWindow(u8 whichWindow) { // Print gift text // Odd that CARD_TYPE_STAMP is not ignored, it has empty text for this - AddTextPrinterParameterized3(windowId, 3, 0, + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, 0, 16 + sCard_FooterTextOffsets[sWonderCardData->card.type], sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->giftText); @@ -461,19 +461,19 @@ static void DrawCardWindow(u8 whichWindow) { s32 x = 0; s32 y = sCard_FooterTextOffsets[sWonderCardData->card.type] + 16; - s32 spacing = GetFontAttribute(3, FONTATTR_LETTER_SPACING); + s32 spacing = GetFontAttribute(FONT_SHORT_COPY_1, FONTATTR_LETTER_SPACING); for (; i < sWonderCardData->statFooterWidth; i++) { // Print stat text - AddTextPrinterParameterized3(windowId, 3, x, y, sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->statTextData[i].statText); + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, x, y, sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->statTextData[i].statText); if (sWonderCardData->statTextData[i].statNumberText[0] != EOS) { // Print stat number - x += GetStringWidth(3, sWonderCardData->statTextData[i].statText, spacing); - AddTextPrinterParameterized3(windowId, 3, x, y, + x += GetStringWidth(FONT_SHORT_COPY_1, sWonderCardData->statTextData[i].statText, spacing); + AddTextPrinterParameterized3(windowId, FONT_SHORT_COPY_1, x, y, sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->statTextData[i].statNumberText); - x += GetStringWidth(3, sWonderCardData->statTextData[i].statNumberText, spacing) + sWonderCardData->statTextData[i].width; + x += GetStringWidth(FONT_SHORT_COPY_1, sWonderCardData->statTextData[i].statNumberText, spacing) + sWonderCardData->statTextData[i].width; } } } @@ -893,14 +893,14 @@ static void DrawNewsWindows(void) FillWindowPixelBuffer(sWonderNewsData->windowIds[NEWS_WIN_BODY], 0); // Print title text - x = (224 - GetStringWidth(3, sWonderNewsData->titleText, GetFontAttribute(3, FONTATTR_LETTER_SPACING))) / 2; + x = (224 - GetStringWidth(FONT_SHORT_COPY_1, sWonderNewsData->titleText, GetFontAttribute(FONT_SHORT_COPY_1, FONTATTR_LETTER_SPACING))) / 2; if (x < 0) x = 0; - AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_TITLE], 3, x, 6, sNews_TextColorTable[sWonderNewsData->gfx->titleTextPal], 0, sWonderNewsData->titleText); + AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_TITLE], FONT_SHORT_COPY_1, x, 6, sNews_TextColorTable[sWonderNewsData->gfx->titleTextPal], 0, sWonderNewsData->titleText); // Print body text for (; i < WONDER_NEWS_BODY_TEXT_LINES; i++) - AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_BODY], 3, 0, + AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_BODY], FONT_SHORT_COPY_1, 0, 16 * i + 2, sNews_TextColorTable[sWonderNewsData->gfx->bodyTextPal], 0, sWonderNewsData->bodyText[i]); diff --git a/src/naming_screen.c b/src/naming_screen.c index f6558921b..65629215c 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -740,7 +740,7 @@ static void DisplaySentToPCMessage(void) StringExpandPlaceholders(gStringVar4, sTransferredToPCMessages[stringToDisplay]); DrawDialogueFrame(0, 0); gTextFlags.canABSpeedUpPrint = TRUE; - AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); CopyWindowToVram(0, 3); } @@ -1714,7 +1714,7 @@ static void HandleDpadMovement(struct Task *task) static void DrawNormalTextEntryBox(void) { FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); - AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], 1, sNamingScreen->template->title, 8, 1, 0, 0); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_NORMAL, sNamingScreen->template->title, 8, 1, 0, 0); PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX]); } @@ -1725,7 +1725,7 @@ static void DrawMonTextEntryBox(void) StringCopy(buffer, gSpeciesNames[sNamingScreen->monSpecies]); StringAppendN(buffer, sNamingScreen->template->title, 15); FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); - AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], 1, buffer, 8, 1, 0, 0); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_NORMAL, buffer, 8, 1, 0, 0); PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX]); } @@ -1781,7 +1781,7 @@ static void DrawGenderIcon(void) StringCopy(text, gText_FemaleSymbol); isFemale = TRUE; } - AddTextPrinterParameterized3(sNamingScreen->windows[WIN_TEXT_ENTRY], 1, 0x68, 1, sGenderColors[isFemale], -1, text); + AddTextPrinterParameterized3(sNamingScreen->windows[WIN_TEXT_ENTRY], FONT_NORMAL, 0x68, 1, sGenderColors[isFemale], -1, text); } } @@ -1921,7 +1921,7 @@ static void DrawTextEntry(void) temp[1] = gText_ExpandedPlaceholder_Empty[0]; extraWidth = (IsWideLetter(temp[0]) == TRUE) ? 2 : 0; - AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY], 1, temp, i * 8 + x + extraWidth, 1, 0xFF, NULL); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY], FONT_NORMAL, temp, i * 8 + x + extraWidth, 1, 0xFF, NULL); } TryDrawGenderIcon(); @@ -1964,7 +1964,7 @@ static void PrintKeyboardKeys(u8 window, u8 page) FillWindowPixelBuffer(window, sFillValues[page]); for (i = 0; i < KBROW_COUNT; i++) - AddTextPrinterParameterized3(window, 1, 0, i * 16 + 1, sKeyboardTextColors[page], 0, sNamingScreenKeyboardText[page][i]); + AddTextPrinterParameterized3(window, FONT_NORMAL, 0, i * 16 + 1, sKeyboardTextColors[page], 0, sNamingScreenKeyboardText[page][i]); PutWindowTilemap(window); } @@ -2010,7 +2010,7 @@ static void PrintControls(void) const u8 color[3] = { TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; FillWindowPixelBuffer(sNamingScreen->windows[WIN_BANNER], PIXEL_FILL(15)); - AddTextPrinterParameterized3(sNamingScreen->windows[WIN_BANNER], 0, 2, 1, color, 0, gText_MoveOkBack); + AddTextPrinterParameterized3(sNamingScreen->windows[WIN_BANNER], FONT_SMALL, 2, 1, color, 0, gText_MoveOkBack); PutWindowTilemap(sNamingScreen->windows[WIN_BANNER]); CopyWindowToVram(sNamingScreen->windows[WIN_BANNER], 3); } diff --git a/src/option_menu.c b/src/option_menu.c index 0174b69db..d96ed1ecf 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -400,7 +400,7 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style) } dst[i] = EOS; - AddTextPrinterParameterized(WIN_OPTIONS, 1, dst, x, y + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_OPTIONS, FONT_NORMAL, dst, x, y + 1, TEXT_SPEED_FF, NULL); } static u8 TextSpeed_ProcessInput(u8 selection) @@ -438,15 +438,15 @@ static void TextSpeed_DrawChoices(u8 selection) DrawOptionMenuChoice(gText_TextSpeedSlow, 104, YPOS_TEXTSPEED, styles[0]); - widthSlow = GetStringWidth(1, gText_TextSpeedSlow, 0); - widthMid = GetStringWidth(1, gText_TextSpeedMid, 0); - widthFast = GetStringWidth(1, gText_TextSpeedFast, 0); + widthSlow = GetStringWidth(FONT_NORMAL, gText_TextSpeedSlow, 0); + widthMid = GetStringWidth(FONT_NORMAL, gText_TextSpeedMid, 0); + widthFast = GetStringWidth(FONT_NORMAL, gText_TextSpeedFast, 0); widthMid -= 94; xMid = (widthSlow - widthMid - widthFast) / 2 + 104; DrawOptionMenuChoice(gText_TextSpeedMid, xMid, YPOS_TEXTSPEED, styles[1]); - DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), YPOS_TEXTSPEED, styles[2]); + DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(FONT_NORMAL, gText_TextSpeedFast, 198), YPOS_TEXTSPEED, styles[2]); } static u8 BattleScene_ProcessInput(u8 selection) @@ -469,7 +469,7 @@ static void BattleScene_DrawChoices(u8 selection) styles[selection] = 1; DrawOptionMenuChoice(gText_BattleSceneOn, 104, YPOS_BATTLESCENE, styles[0]); - DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), YPOS_BATTLESCENE, styles[1]); + DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(FONT_NORMAL, gText_BattleSceneOff, 198), YPOS_BATTLESCENE, styles[1]); } static u8 BattleStyle_ProcessInput(u8 selection) @@ -492,7 +492,7 @@ static void BattleStyle_DrawChoices(u8 selection) styles[selection] = 1; DrawOptionMenuChoice(gText_BattleStyleShift, 104, YPOS_BATTLESTYLE, styles[0]); - DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), YPOS_BATTLESTYLE, styles[1]); + DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(FONT_NORMAL, gText_BattleStyleSet, 198), YPOS_BATTLESTYLE, styles[1]); } static u8 Sound_ProcessInput(u8 selection) @@ -516,7 +516,7 @@ static void Sound_DrawChoices(u8 selection) styles[selection] = 1; DrawOptionMenuChoice(gText_SoundMono, 104, YPOS_SOUND, styles[0]); - DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), YPOS_SOUND, styles[1]); + DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(FONT_NORMAL, gText_SoundStereo, 198), YPOS_SOUND, styles[1]); } static u8 FrameType_ProcessInput(u8 selection) @@ -612,21 +612,21 @@ static void ButtonMode_DrawChoices(u8 selection) DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, YPOS_BUTTONMODE, styles[0]); - widthNormal = GetStringWidth(1, gText_ButtonTypeNormal, 0); - widthLR = GetStringWidth(1, gText_ButtonTypeLR, 0); - widthLA = GetStringWidth(1, gText_ButtonTypeLEqualsA, 0); + widthNormal = GetStringWidth(FONT_NORMAL, gText_ButtonTypeNormal, 0); + widthLR = GetStringWidth(FONT_NORMAL, gText_ButtonTypeLR, 0); + widthLA = GetStringWidth(FONT_NORMAL, gText_ButtonTypeLEqualsA, 0); widthLR -= 94; xLR = (widthNormal - widthLR - widthLA) / 2 + 104; DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, YPOS_BUTTONMODE, styles[1]); - DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), YPOS_BUTTONMODE, styles[2]); + DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(FONT_NORMAL, gText_ButtonTypeLEqualsA, 198), YPOS_BUTTONMODE, styles[2]); } static void DrawTextOption(void) { FillWindowPixelBuffer(WIN_TEXT_OPTION, PIXEL_FILL(1)); - AddTextPrinterParameterized(WIN_TEXT_OPTION, 1, gText_Option, 8, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_TEXT_OPTION, FONT_NORMAL, gText_Option, 8, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(WIN_TEXT_OPTION, 3); } @@ -637,7 +637,7 @@ static void DrawOptionMenuTexts(void) FillWindowPixelBuffer(WIN_OPTIONS, PIXEL_FILL(1)); for (i = 0; i < MENUITEM_COUNT; i++) { - AddTextPrinterParameterized(WIN_OPTIONS, 1, sOptionMenuItemsNames[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_OPTIONS, FONT_NORMAL, sOptionMenuItemsNames[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); } CopyWindowToVram(WIN_OPTIONS, 3); } diff --git a/src/party_menu.c b/src/party_menu.c index 14215f9c0..1c02a4fe8 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2035,8 +2035,8 @@ static void CreateCancelConfirmWindows(bool8 chooseHalf) { confirmWindowId = AddWindow(&sConfirmButtonWindowTemplate); FillWindowPixelBuffer(confirmWindowId, PIXEL_FILL(0)); - mainOffset = GetStringCenterAlignXOffset(0, gMenuText_Confirm, 48); - AddTextPrinterParameterized4(confirmWindowId, 0, mainOffset, 1, 0, 0, sFontColorTable[0], -1, gMenuText_Confirm); + mainOffset = GetStringCenterAlignXOffset(FONT_SMALL, gMenuText_Confirm, 48); + AddTextPrinterParameterized4(confirmWindowId, FONT_SMALL, mainOffset, 1, 0, 0, sFontColorTable[0], -1, gMenuText_Confirm); PutWindowTilemap(confirmWindowId); CopyWindowToVram(confirmWindowId, 2); cancelWindowId = AddWindow(&sMultiCancelButtonWindowTemplate); @@ -2052,13 +2052,13 @@ static void CreateCancelConfirmWindows(bool8 chooseHalf) // Branches are functionally identical. Second branch is never reached, Spin Trade wasnt fully implemented if (gPartyMenu.menuType != PARTY_MENU_TYPE_SPIN_TRADE) { - mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel, 48); - AddTextPrinterParameterized3(cancelWindowId, 0, mainOffset + offset, 1, sFontColorTable[0], -1, gText_Cancel); + mainOffset = GetStringCenterAlignXOffset(FONT_SMALL, gText_Cancel, 48); + AddTextPrinterParameterized3(cancelWindowId, FONT_SMALL, mainOffset + offset, 1, sFontColorTable[0], -1, gText_Cancel); } else { - mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel2, 48); - AddTextPrinterParameterized3(cancelWindowId, 0, mainOffset + offset, 1, sFontColorTable[0], -1, gText_Cancel2); + mainOffset = GetStringCenterAlignXOffset(FONT_SMALL, gText_Cancel2, 48); + AddTextPrinterParameterized3(cancelWindowId, FONT_SMALL, mainOffset + offset, 1, sFontColorTable[0], -1, gText_Cancel2); } PutWindowTilemap(cancelWindowId); CopyWindowToVram(cancelWindowId, 2); @@ -2205,7 +2205,7 @@ static void LoadPartyBoxPalette(struct PartyMenuBox *menuBox, u8 palFlags) static void DisplayPartyPokemonBarDetail(u8 windowId, const u8 *str, u8 color, const u8 *align) { - AddTextPrinterParameterized3(windowId, 0, align[0], align[1], sFontColorTable[color], 0, str); + AddTextPrinterParameterized3(windowId, FONT_SMALL, align[0], align[1], sFontColorTable[color], 0, str); } static void DisplayPartyPokemonNickname(struct Pokemon *mon, struct PartyMenuBox *menuBox, u8 c) @@ -2366,7 +2366,7 @@ static void DisplayPartyPokemonDescriptionText(u8 stringID, struct PartyMenuBox menuBox->infoRects->blitFunc(menuBox->windowId, menuBox->infoRects->descTextLeft >> 3, menuBox->infoRects->descTextTop >> 3, width, height, TRUE); } if (c != 2) - AddTextPrinterParameterized3(menuBox->windowId, 1, menuBox->infoRects->descTextLeft, menuBox->infoRects->descTextTop, sFontColorTable[0], 0, sDescriptionStringTable[stringID]); + AddTextPrinterParameterized3(menuBox->windowId, FONT_NORMAL, menuBox->infoRects->descTextLeft, menuBox->infoRects->descTextTop, sFontColorTable[0], 0, sDescriptionStringTable[stringID]); } static void PartyMenuRemoveWindow(u8 *ptr) @@ -2421,7 +2421,7 @@ void DisplayPartyMenuStdMessage(u32 stringId) } DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 0xD); StringExpandPlaceholders(gStringVar4, sActionStringTable[stringId]); - AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0); + AddTextPrinterParameterized(*windowPtr, FONT_NORMAL, gStringVar4, 0, 1, 0, 0); ScheduleBgCopyTilemapToVram(2); } } @@ -2449,7 +2449,7 @@ static u8 DisplaySelectionWindow(u8 windowType) { struct WindowTemplate window; u8 cursorDimension; - u8 fontAttribute; + u8 letterSpacing; u8 i; switch (windowType) @@ -2472,13 +2472,13 @@ static u8 DisplaySelectionWindow(u8 windowType) DrawStdFrameWithCustomTileAndPalette(sPartyMenuInternal->windowId[0], FALSE, 0x4F, 13); if (windowType == SELECTWINDOW_MOVES) return sPartyMenuInternal->windowId[0]; - cursorDimension = GetMenuCursorDimensionByFont(1, 0); - fontAttribute = GetFontAttribute(1, 2); + cursorDimension = GetMenuCursorDimensionByFont(FONT_NORMAL, 0); + letterSpacing = GetFontAttribute(FONT_NORMAL, FONTATTR_LETTER_SPACING); for (i = 0; i < sPartyMenuInternal->numActions; i++) { u8 fontColorsId = (sPartyMenuInternal->actions[i] >= MENU_FIELD_MOVES) ? 4 : 3; - AddTextPrinterParameterized4(sPartyMenuInternal->windowId[0], 1, cursorDimension, (i * 16) + 1, fontAttribute, 0, sFontColorTable[fontColorsId], 0, sCursorOptions[sPartyMenuInternal->actions[i]].text); + AddTextPrinterParameterized4(sPartyMenuInternal->windowId[0], FONT_NORMAL, cursorDimension, (i * 16) + 1, letterSpacing, 0, sFontColorTable[fontColorsId], 0, sCursorOptions[sPartyMenuInternal->actions[i]].text); } InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, 1); @@ -2491,7 +2491,7 @@ static void PartyMenuPrintText(const u8 *text) { DrawStdFrameWithCustomTileAndPalette(6, FALSE, 0x4F, 13); gTextFlags.canABSpeedUpPrint = TRUE; - AddTextPrinterParameterized2(6, 1, text, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); + AddTextPrinterParameterized2(6, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); } static void PartyMenuDisplayYesNoMenu(void) @@ -2792,7 +2792,7 @@ static void SwitchSelectedMons(u8 taskId) // returns FALSE if the slot has slid fully offscreen / back onscreen static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newWidth) { - if ((x + width) < 0) + if (x + width < 0) return FALSE; if (x > 31) return FALSE; @@ -2807,7 +2807,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW { *leftMove = 0; *newX = x; - if ((x + width) > 31) + if (x + width > 31) *newWidth = 32 - x; else *newWidth = width; @@ -2818,14 +2818,13 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW static void MoveAndBufferPartySlot(const void *rectSrc, s16 x, s16 y, s16 width, s16 height, s16 dir) { - // The use of the dimension parameters here is a mess - u8 leftMove, newX, newWidth; // leftMove is used as a srcX, newX is used as both x and srcHeight, newWidth is used as both width and destY + u8 srcX, newX, newWidth; - if (TryMovePartySlot(x, width, &leftMove, &newX, &newWidth)) + if (TryMovePartySlot(x, width, &srcX, &newX, &newWidth)) { FillBgTilemapBufferRect_Palette0(0, 0, newX, y, newWidth, height); - if (TryMovePartySlot(x + dir, width, &leftMove, &newX, &newWidth)) - CopyRectToBgTilemapBufferRect(0, rectSrc, leftMove, 0, width, height, newX, y, newWidth, height, 17, 0, 0); + if (TryMovePartySlot(x + dir, width, &srcX, &newX, &newWidth)) + CopyRectToBgTilemapBufferRect(0, rectSrc, srcX, 0, width, height, newX, y, newWidth, height, 17, 0, 0); } } @@ -4498,7 +4497,7 @@ static void ShowMoveSelectWindow(u8 slot) { u8 i; u8 moveCount = 0; - u8 fontId = 1; + u8 fontId = FONT_NORMAL; u8 windowId = DisplaySelectionWindow(SELECTWINDOW_MOVES); u16 move; diff --git a/src/player_pc.c b/src/player_pc.c index 3b37b0219..b83ecdaba 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -291,7 +291,7 @@ static const struct ListMenuTemplate sListMenuTemplate_ItemStorage = .lettersSpacing = FALSE, .itemVerticalPadding = 0, .scrollMultiple = FALSE, - .fontId = 7 + .fontId = FONT_NARROW }; static const struct WindowTemplate sWindowTemplates_ItemStorage[ITEMPC_WIN_COUNT] = @@ -519,7 +519,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) static void ItemStorageMenuPrint(const u8 *textPtr) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, textPtr, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, textPtr, 0, 1, 0, 0); } static void ItemStorageMenuProcessInput(u8 taskId) @@ -691,7 +691,7 @@ static void Mailbox_DrawMailboxMenu(u8 taskId) { u8 windowId = MailboxMenu_AddWindow(MAILBOXWIN_TITLE); MailboxMenu_AddWindow(MAILBOXWIN_LIST); - AddTextPrinterParameterized(windowId, 1, gText_Mailbox, GetStringCenterAlignXOffset(1, gText_Mailbox, 0x40), 1, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_Mailbox, GetStringCenterAlignXOffset(FONT_NORMAL, gText_Mailbox, 0x40), 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].tListTaskId = MailboxMenu_CreateList(&gPlayerPCItemPageInfo); MailboxMenu_AddScrollArrows(&gPlayerPCItemPageInfo); @@ -1033,7 +1033,7 @@ static void ItemStorage_PrintMenuItem(u8 windowId, u32 id, u8 yOffset) } ConvertIntToDecimalStringN(gStringVar1, gSaveBlock1Ptr->pcItems[id].quantity, STR_CONV_MODE_RIGHT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_xVar1); - AddTextPrinterParameterized(windowId, 7, gStringVar4, GetStringRightAlignXOffset(7, gStringVar4, 104), yOffset, 0xFF, NULL); + AddTextPrinterParameterized(windowId, FONT_NARROW, gStringVar4, GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 104), yOffset, 0xFF, NULL); } } @@ -1049,7 +1049,7 @@ static void ItemStorage_PrintDescription(s32 id) description = ItemStorage_GetMessage(MSG_GO_BACK_TO_PREV); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(windowId, 1, description, 0, 1, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, description, 0, 1, 0, NULL); } static void ItemStorage_AddScrollIndicator(void) @@ -1080,9 +1080,9 @@ static void ItemStorage_DrawSwapArrow(u8 y, u8 b, u8 speed) { u8 windowId = sItemStorageMenu->windowIds[ITEMPC_WIN_LIST]; if (b == 0xFF) - FillWindowPixelRect(windowId, PIXEL_FILL(1), 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1)); + FillWindowPixelRect(windowId, PIXEL_FILL(1), 0, y, GetMenuCursorDimensionByFont(FONT_NORMAL, 0), GetMenuCursorDimensionByFont(FONT_NORMAL, 1)); else - AddTextPrinterParameterized4(windowId, 1, 0, y, 0, 0, sSwapArrowTextColors, speed, gText_SelectorArrow2); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, y, 0, 0, sSwapArrowTextColors, speed, gText_SelectorArrow2); } static void ItemStorage_DrawItemIcon(u16 itemId) @@ -1142,8 +1142,8 @@ static void ItemStorage_CreateListMenu(u8 taskId) text = gText_TossItem; if (!toss) text = gText_WithdrawItem; - x = GetStringCenterAlignXOffset(1, text, 104); - AddTextPrinterParameterized(sItemStorageMenu->windowIds[ITEMPC_WIN_TITLE], 1, text, x, 1, 0, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, text, 104); + AddTextPrinterParameterized(sItemStorageMenu->windowIds[ITEMPC_WIN_TITLE], FONT_NORMAL, text, x, 1, 0, NULL); CopyWindowToVram(sItemStorageMenu->windowIds[ITEMPC_WIN_ICON], 2); ItemStorage_CompactList(); ItemStorage_CompactCursor(); @@ -1199,7 +1199,7 @@ static void ItemStorage_PrintMessage(const u8 *string) u8 windowId = sItemStorageMenu->windowIds[ITEMPC_WIN_MESSAGE]; FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); StringExpandPlaceholders(gStringVar4, string); - AddTextPrinterParameterized(windowId, 1, gStringVar4, 0, 1, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL); } // Process input while on the item storage's item list @@ -1338,7 +1338,7 @@ static void ItemStorage_PrintItemQuantity(u8 windowId, u16 value, u32 mode, u8 x { ConvertIntToDecimalStringN(gStringVar1, value, mode, n); StringExpandPlaceholders(gStringVar4, gText_xVar1); - AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 48), y, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar4, 48), y, 0, NULL); } // Start an item Withdraw/Toss diff --git a/src/pokeblock.c b/src/pokeblock.c index 67c9602d2..44893b283 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -439,7 +439,7 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 1 }; @@ -692,7 +692,7 @@ static void HandleInitWindows(void) static void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x) { - AddTextPrinterParameterized4(windowId, 1, x, 1, 0, 0, sTextColor, 0, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, 1, 0, 0, sTextColor, 0, string); } static void DrawPokeblockMenuTitleText(void) @@ -700,7 +700,7 @@ static void DrawPokeblockMenuTitleText(void) u8 i; const u8 *itemName = ItemId_GetName(ITEM_POKEBLOCK_CASE); - PrintOnPokeblockWindow(WIN_TITLE, itemName, GetStringCenterAlignXOffset(1, itemName, 0x48)); + PrintOnPokeblockWindow(WIN_TITLE, itemName, GetStringCenterAlignXOffset(FONT_NORMAL, itemName, 0x48)); PrintOnPokeblockWindow(WIN_SPICY, gText_Spicy, 0); PrintOnPokeblockWindow(WIN_DRY, gText_Dry, 0); @@ -728,7 +728,7 @@ static void UpdatePokeblockList(void) sPokeblockMenu->items[i].id = LIST_CANCEL; gMultiuseListMenuTemplate = sPokeblockListMenuTemplate; - gMultiuseListMenuTemplate.fontId = 7; + gMultiuseListMenuTemplate.fontId = FONT_NARROW; gMultiuseListMenuTemplate.totalItems = sPokeblockMenu->itemsNo; gMultiuseListMenuTemplate.items = sPokeblockMenu->items; gMultiuseListMenuTemplate.maxShowed = sPokeblockMenu->maxShowed; @@ -1204,7 +1204,7 @@ static void PokeblockAction_Toss(u8 taskId) ClearStdWindowAndFrameToTransparent(tWindowId, FALSE); StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]); StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1); - DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu); + DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, FONT_NORMAL, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu); } static void CreateTossPokeblockYesNoMenu(u8 taskId) @@ -1215,7 +1215,7 @@ static void CreateTossPokeblockYesNoMenu(u8 taskId) static void TossedPokeblockMessage(u8 taskId) { StringExpandPlaceholders(gStringVar4, gText_Var1ThrownAway); - DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, TossPokeblock); + DisplayMessageAndContinueTask(taskId, WIN_TOSS_MSG, 10, 13, FONT_NORMAL, GetPlayerTextSpeedDelay(), gStringVar4, TossPokeblock); } static void TossPokeblock(u8 taskId) diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index 1253f2285..da9b7767c 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -872,7 +872,7 @@ static void Task_PrintAtePokeblockMessage(u8 taskId) StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2); gTextFlags.canABSpeedUpPrint = TRUE; - AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3); gTasks[taskId].func = Task_WaitForAtePokeblockMessage; } diff --git a/src/pokedex.c b/src/pokedex.c index 81d7c6730..8a8576243 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2427,7 +2427,7 @@ static void CreateMonDexNum(u16 entryNum, u8 left, u8 top, u16 unused) text[2] = CHAR_0 + dexNum / 100; text[3] = CHAR_0 + (dexNum % 100) / 10; text[4] = CHAR_0 + (dexNum % 100) % 10; - PrintMonDexNumAndName(0, 7, text, left, top); + PrintMonDexNumAndName(0, FONT_NARROW, text, left, top); } static void CreateCaughtBall(bool16 owned, u8 x, u8 y, u16 unused) @@ -2447,7 +2447,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top) str = gSpeciesNames[num]; else str = sText_TenDashes; - PrintMonDexNumAndName(0, 7, str, left, top); + PrintMonDexNumAndName(0, FONT_NARROW, str, left, top); return StringLength(str); } @@ -3167,7 +3167,7 @@ static void PrintInfoScreenText(const u8* str, u8 left, u8 top) color[1] = TEXT_DYNAMIC_COLOR_6; color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str); + AddTextPrinterParameterized4(0, FONT_NORMAL, left, top, 0, 0, color, -1, str); } #define tScrolling data[0] @@ -3752,7 +3752,7 @@ static void Task_LoadSizeScreen(u8 taskId) StringCopy(string, gText_SizeComparedTo); StringAppend(string, gSaveBlock2Ptr->playerName); - PrintInfoScreenText(string, GetStringCenterAlignXOffset(1, string, 0xF0), 0x79); + PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, 0xF0), 0x79); gMain.state++; } break; @@ -4100,7 +4100,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) const u8 *description; if (newEntry) - PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(1, gText_PokedexRegistration, 0xF0), 0); + PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, 0xF0), 0); if (value == 0) value = NationalToHoennOrder(num); else @@ -4139,7 +4139,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) description = gPokedexEntries[num].description; else description = gExpandedPlaceholder_PokedexDescription; - PrintInfoScreenText(description, GetStringCenterAlignXOffset(1, description, 0xF0), 0x5F); + PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F); } static void PrintMonHeight(u16 height, u8 left, u8 top) @@ -4167,10 +4167,10 @@ static void PrintMonHeight(u16 height, u8 left, u8 top) buffer[i++] = feet / 10 + CHAR_0; buffer[i++] = (feet % 10) + CHAR_0; } - buffer[i++] = CHAR_SGL_QUOT_RIGHT; + buffer[i++] = CHAR_SGL_QUOTE_RIGHT; buffer[i++] = (inches / 10) + CHAR_0; buffer[i++] = (inches % 10) + CHAR_0; - buffer[i++] = CHAR_DBL_QUOT_RIGHT; + buffer[i++] = CHAR_DBL_QUOTE_RIGHT; buffer[i++] = EOS; PrintInfoScreenText(buffer, left, top); } @@ -4474,7 +4474,7 @@ static void PrintInfoSubMenuText(u8 windowId, const u8 *str, u8 left, u8 top) color[1] = TEXT_DYNAMIC_COLOR_6; color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(windowId, 1, left, top, 0, 0, color, -1, str); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, left, top, 0, 0, color, -1, str); } static void UnusedPrintNum(u8 windowId, u16 num, u8 left, u8 top) @@ -4781,7 +4781,7 @@ static void PrintSearchText(const u8 *str, u32 x, u32 y) color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; color[2] = TEXT_COLOR_DARK_GRAY; - AddTextPrinterParameterized4(0, 1, x, y, 0, 0, color, -1, str); + AddTextPrinterParameterized4(0, FONT_NORMAL, x, y, 0, 0, color, -1, str); } static void ClearSearchMenuRect(u32 x, u32 y, u32 width, u32 height) diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 2ad25576f..fb1505c6c 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -3313,7 +3313,7 @@ static void Msg_WantToPlayAgain(void) { case 0: sPokemonJumpGfx->msgWindowId = AddMessageWindow(1, 8, 20, 2); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->mainState++; break; @@ -3340,7 +3340,7 @@ static void Msg_SavingDontTurnOff(void) { case 0: sPokemonJumpGfx->msgWindowId = AddMessageWindow(2, 7, 26, 4); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->mainState++; break; @@ -3383,7 +3383,7 @@ static void Msg_SomeoneDroppedOut(void) { case 0: sPokemonJumpGfx->msgWindowId = AddMessageWindow(2, 8, 22, 4); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->mainState++; break; @@ -3409,7 +3409,7 @@ static void Msg_CommunicationStandby(void) { case 0: sPokemonJumpGfx->msgWindowId = AddMessageWindow(7, 10, 16, 2); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->mainState++; break; @@ -3487,7 +3487,7 @@ static void PrintPrizeMessage(u16 itemId, u16 quantity) DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, sPokemonJumpGfx->itemQuantityStr); DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_AwesomeWonF701F700); sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 8, 22, 4); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->fanfare = MUS_LEVEL_UP; sPokemonJumpGfx->msgWindowState = 0; @@ -3500,7 +3500,7 @@ static void PrintPrizeFilledBagMessage(u16 itemId) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPokemonJumpGfx->itemName); DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_FilledStorageSpace2); sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 8, 22, 4); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->fanfare = MUS_DUMMY; sPokemonJumpGfx->msgWindowState = 0; @@ -3513,7 +3513,7 @@ static void PrintNoRoomForPrizeMessage(u16 itemId) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPokemonJumpGfx->itemName); DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_CantHoldMore); sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 9, 22, 2); - AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, FONT_NORMAL, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); sPokemonJumpGfx->fanfare = MUS_DUMMY; sPokemonJumpGfx->msgWindowState = 0; @@ -3634,8 +3634,8 @@ static void PrintScoreSuffixes(void) PutWindowTilemap(WIN_TIMES); FillWindowPixelBuffer(WIN_POINTS, 0); FillWindowPixelBuffer(WIN_TIMES, 0); - AddTextPrinterParameterized3(WIN_POINTS, 0, 0, 1, color, 0, gText_SpacePoints2); - AddTextPrinterParameterized3(WIN_TIMES, 0, 0, 1, color, 0, gText_SpaceTimes3); + AddTextPrinterParameterized3(WIN_POINTS, FONT_SMALL, 0, 1, color, 0, gText_SpacePoints2); + AddTextPrinterParameterized3(WIN_TIMES, FONT_SMALL, 0, 1, color, 0, gText_SpaceTimes3); } // The venusaurs in the background are actually an empty 256x512 bg with 3 pairs of venusaurs on it. @@ -3855,9 +3855,9 @@ static void PrintPokeJumpPlayerName(int multiplayerId, u8 bgColor, u8 fgColor, u u8 colors[3] = {bgColor, fgColor, shadow}; FillWindowPixelBuffer(sPokemonJumpGfx->nameWindowIds[multiplayerId], 0); - x = 64 - GetStringWidth(1, GetPokeJumpPlayerName(multiplayerId), -1); + x = 64 - GetStringWidth(FONT_NORMAL, GetPokeJumpPlayerName(multiplayerId), -1); x /= 2; - AddTextPrinterParameterized3(sPokemonJumpGfx->nameWindowIds[multiplayerId], 1, x, 1, colors, -1, GetPokeJumpPlayerName(multiplayerId)); + AddTextPrinterParameterized3(sPokemonJumpGfx->nameWindowIds[multiplayerId], FONT_NORMAL, x, 1, colors, -1, GetPokeJumpPlayerName(multiplayerId)); CopyWindowToVram(sPokemonJumpGfx->nameWindowIds[multiplayerId], 2); } @@ -4162,10 +4162,10 @@ static void Task_ShowPokemonJumpRecords(u8 taskId) { case 0: window = sWindowTemplate_Records; - width = GetStringWidth(1, gText_PkmnJumpRecords, 0); + width = GetStringWidth(FONT_NORMAL, gText_PkmnJumpRecords, 0); for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) { - widthCurr = GetStringWidth(1, sRecordsTexts[i], 0) + 38; + widthCurr = GetStringWidth(FONT_NORMAL, sRecordsTexts[i], 0) + 38; if (widthCurr > width) width = widthCurr; } @@ -4217,14 +4217,14 @@ static void PrintRecordsText(u16 windowId, int width) LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(windowId, 1, gText_PkmnJumpRecords, GetStringCenterAlignXOffset(1, gText_PkmnJumpRecords, width * 8), 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_PkmnJumpRecords, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PkmnJumpRecords, width * 8), 1, TEXT_SPEED_FF, NULL); for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) { - AddTextPrinterParameterized(windowId, 1, sRecordsTexts[i], 0, 25 + (i * 16), TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, sRecordsTexts[i], 0, 25 + (i * 16), TEXT_SPEED_FF, NULL); ConvertIntToDecimalStringN(gStringVar1, recordNums[i], STR_CONV_MODE_LEFT_ALIGN, 5); TruncateToFirstWordOnly(gStringVar1); - x = (width * 8) - GetStringWidth(1, gStringVar1, 0); - AddTextPrinterParameterized(windowId, 1, gStringVar1, x, 25 + (i * 16), TEXT_SPEED_FF, NULL); + x = (width * 8) - GetStringWidth(FONT_NORMAL, gStringVar1, 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar1, x, 25 + (i * 16), TEXT_SPEED_FF, NULL); } PutWindowTilemap(windowId); } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index e18a6db76..ee2d9b1a7 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1358,7 +1358,7 @@ void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero txtColor[0] = zero2; txtColor[1] = TEXT_DYNAMIC_COLOR_6; txtColor[2] = TEXT_DYNAMIC_COLOR_5; - AddTextPrinterParameterized4(windowId, 1, 0, 1, 0, 0, txtColor, -1, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, 1, 0, 0, txtColor, -1, string); tileBytesToBuffer = bytesToBuffer; if (tileBytesToBuffer > 6u) @@ -1402,7 +1402,7 @@ static void UnusedDrawTextWindow(const u8 *string, void *dst, u16 offset, u8 bgC txtColor[0] = bgColor; txtColor[1] = fgColor; txtColor[2] = shadowColor; - AddTextPrinterParameterized4(windowId, 1, 0, 2, 0, 0, txtColor, -1, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, 2, 0, 0, txtColor, -1, string); CpuCopy16(tileData1, dst, tileSize); CpuCopy16(tileData2, dst + offset, tileSize); RemoveWindow(windowId); @@ -1561,7 +1561,7 @@ static void Task_PCMainMenu(u8 taskId) LoadMessageBoxAndBorderGfx(); DrawDialogueFrame(0, 0); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sMainMenuTexts[task->tSelectedOption].desc, TEXT_SPEED_FF, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMainMenuTexts[task->tSelectedOption].desc, TEXT_SPEED_FF, NULL, 2, 1, 3); CopyWindowToVram(0, 3); CopyWindowToVram(task->tWindowId, 3); task->tState++; @@ -1585,7 +1585,7 @@ static void Task_PCMainMenu(u8 taskId) { task->tSelectedOption = task->tNextOption; FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); } break; case MENU_B_PRESSED: @@ -1601,14 +1601,14 @@ static void Task_PCMainMenu(u8 taskId) { // Can't withdraw FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gText_PartyFull, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_PartyFull, 0, NULL, 2, 1, 3); task->tState = STATE_ERROR_MSG; } else if (task->tInput == OPTION_DEPOSIT && CountPartyMons() == 1) { // Can't deposit FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gText_JustOnePkmn, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_JustOnePkmn, 0, NULL, 2, 1, 3); task->tState = STATE_ERROR_MSG; } else @@ -1626,7 +1626,7 @@ static void Task_PCMainMenu(u8 taskId) if (JOY_NEW(A_BUTTON | B_BUTTON)) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); task->tState = STATE_HANDLE_INPUT; } else if (JOY_NEW(DPAD_UP)) @@ -1636,7 +1636,7 @@ static void Task_PCMainMenu(u8 taskId) Menu_MoveCursor(-1); task->tSelectedOption = Menu_GetCursorPos(); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); task->tState = STATE_HANDLE_INPUT; } else if (JOY_NEW(DPAD_DOWN)) @@ -1646,7 +1646,7 @@ static void Task_PCMainMenu(u8 taskId) Menu_MoveCursor(1); task->tSelectedOption = Menu_GetCursorPos(); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sMainMenuTexts[task->tSelectedOption].desc, 0, NULL, 2, 1, 3); task->tState = STATE_HANDLE_INPUT; } break; @@ -1950,14 +1950,14 @@ static void ChooseBoxMenu_PrintInfo(void) FillWindowPixelBuffer(windowId, PIXEL_FILL(4)); // Print box name - center = GetStringCenterAlignXOffset(1, boxName, 64); - AddTextPrinterParameterized3(windowId, 1, center, 1, sChooseBoxMenu_TextColors, TEXT_SPEED_FF, boxName); + center = GetStringCenterAlignXOffset(FONT_NORMAL, boxName, 64); + AddTextPrinterParameterized3(windowId, FONT_NORMAL, center, 1, sChooseBoxMenu_TextColors, TEXT_SPEED_FF, boxName); // Print #/30 for number of Pokémon in the box ConvertIntToDecimalStringN(numBoxMonsText, numInBox, STR_CONV_MODE_RIGHT_ALIGN, 2); StringAppend(numBoxMonsText, sText_OutOf30); - center = GetStringCenterAlignXOffset(1, numBoxMonsText, 64); - AddTextPrinterParameterized3(windowId, 1, center, 17, sChooseBoxMenu_TextColors, TEXT_SPEED_FF, numBoxMonsText); + center = GetStringCenterAlignXOffset(FONT_NORMAL, numBoxMonsText, 64); + AddTextPrinterParameterized3(windowId, FONT_NORMAL, center, 17, sChooseBoxMenu_TextColors, TEXT_SPEED_FF, numBoxMonsText); winTileData = GetWindowAttribute(windowId, WINDOW_TILE_DATA); CpuCopy32((void *)winTileData, (void *)OBJ_VRAM0 + 0x100 + (GetSpriteTileStartByTag(sChooseBoxMenu->tileTag) * 32), 0x400); @@ -4005,17 +4005,17 @@ static void PrintDisplayMonInfo(void) FillWindowPixelBuffer(0, PIXEL_FILL(1)); if (sStorage->boxOption != OPTION_MOVE_ITEMS) { - AddTextPrinterParameterized(0, 1, sStorage->displayMonNameText, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, sStorage->displayMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 0, sStorage->displayMonItemName, 6, 43, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SPEED_FF, NULL); } else { - AddTextPrinterParameterized(0, 0, sStorage->displayMonItemName, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 1, sStorage->displayMonNameText, 6, 13, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, sStorage->displayMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); } CopyWindowToVram(0, 2); @@ -4319,7 +4319,7 @@ static void PrintMessage(u8 id) DynamicPlaceholderTextUtil_ExpandPlaceholders(sStorage->messageText, sMessages[id].text); FillWindowPixelBuffer(1, PIXEL_FILL(1)); - AddTextPrinterParameterized(1, 1, sStorage->messageText, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SPEED_FF, NULL); DrawTextBorderOuter(1, 2, 14); PutWindowTilemap(1); CopyWindowToVram(1, 2); @@ -5437,16 +5437,16 @@ static bool32 WaitForWallpaperGfxLoad(void) static void DrawWallpaper(const void *tilemap, s8 direction, u8 offset) { - s16 var = offset * 256; - s16 var2 = (offset * 2) + 3; + s16 tileOffset = offset * 256; + s16 paletteNum = (offset * 2) + 3; s16 x = ((sStorage->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; - CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 0x14, 0x12, x, 2, 0x14, 0x12, 0x11, var, var2); + CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 20, 18, x, 2, 20, 18, 17, tileOffset, paletteNum); if (direction == 0) return; if (direction > 0) - x += 0x14; + x += 20; else x -= 4; @@ -5635,7 +5635,7 @@ static void CycleBoxTitleColor(void) static s16 GetBoxTitleBaseX(const u8 *string) { - return DISPLAY_WIDTH - 64 - GetStringWidth(1, string, 0) / 2; + return DISPLAY_WIDTH - 64 - GetStringWidth(FONT_NORMAL, string, 0) / 2; } @@ -9203,7 +9203,7 @@ static void PrintItemDescription(void) description = ItemId_GetDescription(sStorage->displayMonItemId); FillWindowPixelBuffer(2, PIXEL_FILL(1)); - AddTextPrinterParameterized5(2, 1, description, 4, 0, 0, NULL, 0, 1); + AddTextPrinterParameterized5(2, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1); } static void InitItemInfoWindow(void) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4dbdd1334..5a4858620 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2700,7 +2700,7 @@ static void ResetWindows(void) static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) { - AddTextPrinterParameterized4(windowId, 1, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); } static void PrintMonInfo(void) @@ -2803,21 +2803,21 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_BATTLE_MOVES_TITLE, gText_BattleMoves, 2, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_CONTEST_MOVES_TITLE, gText_ContestMoves, 2, 1, 0, 1); - stringXPos = GetStringRightAlignXOffset(1, gText_Cancel2, 62); + stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Cancel2, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_CANCEL, FALSE, iconXPos); PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_CANCEL, gText_Cancel2, stringXPos, 1, 0, 0); - stringXPos = GetStringRightAlignXOffset(1, gText_Info, 62); + stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Info, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; PrintAOrBButtonIcon(PSS_LABEL_WINDOW_PROMPT_INFO, FALSE, iconXPos); PrintTextOnWindow(PSS_LABEL_WINDOW_PROMPT_INFO, gText_Info, stringXPos, 1, 0, 0); - stringXPos = GetStringRightAlignXOffset(1, gText_Switch, 62); + stringXPos = GetStringRightAlignXOffset(FONT_NORMAL, gText_Switch, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; @@ -2826,17 +2826,17 @@ static void PrintPageNamesAndStats(void) PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_RENTAL, gText_RentalPkmn, 0, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_INFO_TYPE, gText_TypeSlash, 0, 1, 0, 0); - statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_HP4, 42); + statsXPos = 6 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_HP4, 42); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT, gText_HP4, statsXPos, 1, 0, 1); - statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_Attack3, 42); + statsXPos = 6 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_Attack3, 42); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT, gText_Attack3, statsXPos, 17, 0, 1); - statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_Defense3, 42); + statsXPos = 6 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_Defense3, 42); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_LEFT, gText_Defense3, statsXPos, 33, 0, 1); - statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_SpAtk4, 36); + statsXPos = 2 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_SpAtk4, 36); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT, gText_SpAtk4, statsXPos, 1, 0, 1); - statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_SpDef4, 36); + statsXPos = 2 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_SpDef4, 36); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT, gText_SpDef4, statsXPos, 17, 0, 1); - statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_Speed2, 36); + statsXPos = 2 + GetStringCenterAlignXOffset(FONT_NORMAL, gText_Speed2, 36); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATS_RIGHT, gText_Speed2, statsXPos, 33, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP, gText_ExpPoints, 6, 1, 0, 1); PrintTextOnWindow(PSS_LABEL_WINDOW_POKEMON_SKILLS_EXP, gText_NextLv, 6, 17, 0, 1); @@ -3045,7 +3045,7 @@ static void PrintMonOTName(void) { windowId = AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER); PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1); - x = GetStringWidth(1, gText_OTSlash, 0); + x = GetStringWidth(FONT_NORMAL, gText_OTSlash, 0); if (sMonSummaryScreen->summary.OTGender == 0) PrintTextOnWindow(windowId, sMonSummaryScreen->summary.OTName, x, 1, 0, 5); else @@ -3059,7 +3059,7 @@ static void PrintMonOTID(void) if (InBattleFactory() != TRUE && InSlateportBattleTent() != TRUE) { ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_IDNumber2), (u16)sMonSummaryScreen->summary.OTID, STR_CONV_MODE_LEADING_ZEROS, 5); - xPos = GetStringRightAlignXOffset(1, gStringVar1, 56); + xPos = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar1, 56); PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ID), gStringVar1, xPos, 1, 0, 1); } } @@ -3204,7 +3204,7 @@ static bool8 IsInGamePartnerMon(void) static void PrintEggOTName(void) { u32 windowId = AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ORIGINAL_TRAINER); - u32 width = GetStringWidth(1, gText_OTSlash, 0); + u32 width = GetStringWidth(FONT_NORMAL, gText_OTSlash, 0); PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1); PrintTextOnWindow(windowId, gText_FiveMarks, width, 1, 0, 1); } @@ -3214,7 +3214,7 @@ static void PrintEggOTID(void) int x; StringCopy(gStringVar1, gText_IDNumber2); StringAppend(gStringVar1, gText_FiveMarks); - x = GetStringRightAlignXOffset(1, gStringVar1, 56); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar1, 56); PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ID), gStringVar1, x, 1, 0, 1); } @@ -3327,7 +3327,7 @@ static void PrintHeldItemName(void) text = gStringVar1; } - x = GetStringCenterAlignXOffset(1, text, 72) + 6; + x = GetStringCenterAlignXOffset(FONT_NORMAL, text, 72) + 6; PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_HELD_ITEM), text, x, 1, 0, 0); } @@ -3347,7 +3347,7 @@ static void PrintRibbonCount(void) text = gStringVar4; } - x = GetStringCenterAlignXOffset(1, text, 70) + 6; + x = GetStringCenterAlignXOffset(FONT_NORMAL, text, 70) + 6; PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, PSS_DATA_WINDOW_SKILLS_RIBBON_COUNT), text, x, 1, 0, 0); } @@ -3407,7 +3407,7 @@ static void PrintExpPointsNextLevel(void) u32 expToNextLevel; ConvertIntToDecimalStringN(gStringVar1, sum->exp, STR_CONV_MODE_RIGHT_ALIGN, 7); - x = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2; + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar1, 42) + 2; PrintTextOnWindow(windowId, gStringVar1, x, 1, 0, 0); if (sum->level < MAX_LEVEL) @@ -3416,7 +3416,7 @@ static void PrintExpPointsNextLevel(void) expToNextLevel = 0; ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, STR_CONV_MODE_RIGHT_ALIGN, 6); - x = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2; + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar1, 42) + 2; PrintTextOnWindow(windowId, gStringVar1, x, 17, 0, 0); } @@ -3509,14 +3509,14 @@ static void PrintMoveNameAndPP(u8 moveIndex) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sMovesPPLayout); text = gStringVar4; ppState = GetCurrentPpToMaxPpState(summary->pp[moveIndex], pp) + 9; - x = GetStringRightAlignXOffset(1, text, 44); + x = GetStringRightAlignXOffset(FONT_NORMAL, text, 44); } else { PrintTextOnWindow(moveNameWindowId, gText_OneDash, 0, moveIndex * 16 + 1, 0, 1); text = gText_TwoDashes; ppState = 12; - x = GetStringCenterAlignXOffset(1, text, 44); + x = GetStringCenterAlignXOffset(FONT_NORMAL, text, 44); } PrintTextOnWindow(ppValueWindowId, text, x, moveIndex * 16 + 1, 0, ppState); @@ -3669,7 +3669,7 @@ static void PrintNewMoveDetailsOrCancelText(void) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar1); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sMovesPPLayout); - PrintTextOnWindow(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 44), 65, 0, 12); + PrintTextOnWindow(windowId2, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 44), 65, 0, 12); } } diff --git a/src/pokenav_conditions_2.c b/src/pokenav_conditions_2.c index ef3792063..089a56e26 100644 --- a/src/pokenav_conditions_2.c +++ b/src/pokenav_conditions_2.c @@ -572,23 +572,23 @@ bool32 UpdateConditionGraphWindows(u8 mode, u16 bufferIndex, bool8 winMode) if (GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1 || IsConditionMenuSearchMode() == TRUE) { str = GetConditionMonNameBuffer(bufferIndex); - AddTextPrinterParameterized(structPtr->nameGenderWindowId, 1, str, 0, 1, 0, NULL); + AddTextPrinterParameterized(structPtr->nameGenderWindowId, FONT_NORMAL, str, 0, 1, 0, NULL); } break; case 2: if (IsConditionMenuSearchMode() == TRUE) { str = GetConditionMonLocationBuffer(bufferIndex); - AddTextPrinterParameterized(structPtr->nameGenderWindowId, 1, str, 0, 17, 0, NULL); + AddTextPrinterParameterized(structPtr->nameGenderWindowId, FONT_NORMAL, str, 0, 17, 0, NULL); text[0] = EXT_CTRL_CODE_BEGIN; text[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW; text[2] = TEXT_COLOR_BLUE; text[3] = TEXT_COLOR_TRANSPARENT; text[4] = TEXT_COLOR_LIGHT_BLUE; StringCopy(text + 5, gText_Number2); - AddTextPrinterParameterized(structPtr->listIndexWindowId, 1, text, 4, 1, 0, NULL); + AddTextPrinterParameterized(structPtr->listIndexWindowId, FONT_NORMAL, text, 4, 1, 0, NULL); ConvertIntToDecimalStringN(text + 5, GetConditionMonDataBuffer(), STR_CONV_MODE_RIGHT_ALIGN, 4); - AddTextPrinterParameterized(structPtr->listIndexWindowId, 1, text, 28, 1, 0, NULL); + AddTextPrinterParameterized(structPtr->listIndexWindowId, FONT_NORMAL, text, 28, 1, 0, NULL); } break; case 3: diff --git a/src/pokenav_conditions_3.c b/src/pokenav_conditions_3.c index 53987d11d..0e5a9b785 100644 --- a/src/pokenav_conditions_3.c +++ b/src/pokenav_conditions_3.c @@ -655,9 +655,9 @@ static void PrintSearchResultListMenuItems(struct PokenavSub8 *searchList) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); *gStringVar1 = EOS; DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar2, gText_NumberF700); - AddTextPrinterParameterized(searchList->winid, 1, gStringVar2, 4, 1, 0xFF, NULL); + AddTextPrinterParameterized(searchList->winid, FONT_NORMAL, gStringVar2, 4, 1, 0xFF, NULL); ConvertIntToDecimalStringN(gStringVar1, r7, STR_CONV_MODE_RIGHT_ALIGN, 3); - AddTextPrinterParameterized(searchList->winid, 1, gStringVar1, 34, 1, 0xFF, NULL); + AddTextPrinterParameterized(searchList->winid, FONT_NORMAL, gStringVar1, 34, 1, 0xFF, NULL); CopyWindowToVram(searchList->winid, 2); } @@ -674,7 +674,7 @@ static void InitConditionSearchListMenuTemplate(void) template.listTop = 1; template.maxShowed = 8; template.fillValue = 2; - template.fontId = 1; + template.fontId = FONT_NORMAL; template.listFunc.printMonFunc = PrintSearchMonListItem; template.unk14 = NULL; sub_81C81D4(&sConditionSearchResultBgTemplates[1], &template, 0); @@ -705,7 +705,7 @@ static void PrintSearchMonListItem(struct PokenavMonList * item, u8 * dest) } StringGetEnd10(gStringVar3); - dest = GetStringClearToWidth(dest, 1, gStringVar3, 60); + dest = GetStringClearToWidth(dest, FONT_NORMAL, gStringVar3, 60); switch (gender) { default: @@ -723,5 +723,5 @@ static void PrintSearchMonListItem(struct PokenavMonList * item, u8 * dest) *s++ = CHAR_EXTRA_SYMBOL; *s++ = CHAR_LV_2; ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3); - GetStringClearToWidth(dest, 1, gStringVar1, 40); + GetStringClearToWidth(dest, FONT_NORMAL, gStringVar1, 40); } diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 88c1773a6..0166cc10c 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -563,7 +563,7 @@ void PrintHelpBarText(u32 textId) struct PokenavMainMenuResources *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MAIN_MENU); DrawHelpBar(structPtr->helpBarWindowId); - AddTextPrinterParameterized3(structPtr->helpBarWindowId, 1, 0, 1, sHelpBarTextColors, 0, sHelpBarTexts[textId]); + AddTextPrinterParameterized3(structPtr->helpBarWindowId, FONT_NORMAL, 0, 1, sHelpBarTextColors, 0, sHelpBarTexts[textId]); } bool32 WaitForHelpBar(void) diff --git a/src/pokenav_match_call_1.c b/src/pokenav_match_call_1.c index 64957995d..5612ba6cb 100755 --- a/src/pokenav_match_call_1.c +++ b/src/pokenav_match_call_1.c @@ -413,12 +413,12 @@ void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntries *matchCallEntry, if (className && trainerName) { - u8 *str2 = GetStringClearToWidth(str, 7, className, 69); - GetStringClearToWidth(str2, 7, trainerName, 51); + u8 *str2 = GetStringClearToWidth(str, FONT_NARROW, className, 69); + GetStringClearToWidth(str2, FONT_NARROW, trainerName, 51); } else { - GetStringClearToWidth(str, 7, NULL, 120); + GetStringClearToWidth(str, FONT_NARROW, NULL, 120); } } diff --git a/src/pokenav_match_call_2.c b/src/pokenav_match_call_2.c index e3f0bb6ef..727aa3694 100755 --- a/src/pokenav_match_call_2.c +++ b/src/pokenav_match_call_2.c @@ -874,7 +874,7 @@ static void InitMatchCallPokenavListMenuTemplate(void) template.listTop = 1; template.maxShowed = 8; template.fillValue = 3; - template.fontId = 7; + template.fontId = FONT_NARROW; template.listFunc.unk10_2 = BufferMatchCallNameAndDesc; template.unk14 = TryDrawRematchPokeballIcon; sub_81C81D4(&sMatchCallBgTemplates[2], &template, 2); @@ -986,14 +986,14 @@ static void PrintNumberOfBattles(u16 windowId) static void PrintMatchCallInfoLabel(u16 windowId, const u8 *str, int top) { int y = top * 16 + 1; - AddTextPrinterParameterized(windowId, 7, str, 2, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NARROW, str, 2, y, TEXT_SPEED_FF, NULL); } static void PrintMatchCallInfoNumber(u16 windowId, const u8 *str, int top) { - int x = GetStringRightAlignXOffset(7, str, 86); + int x = GetStringRightAlignXOffset(FONT_NARROW, str, 86); int y = top * 16 + 1; - AddTextPrinterParameterized(windowId, 7, str, x, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NARROW, str, x, y, TEXT_SPEED_FF, NULL); } static void PrintMatchCallLocation(struct Pokenav4Struct *state, int arg1) @@ -1007,9 +1007,9 @@ static void PrintMatchCallLocation(struct Pokenav4Struct *state, int arg1) else StringCopy(mapName, gText_Unknown); - x = GetStringCenterAlignXOffset(7, mapName, 88); + x = GetStringCenterAlignXOffset(FONT_NARROW, mapName, 88); FillWindowPixelBuffer(state->locWindowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(state->locWindowId, 7, mapName, x, 1, 0, NULL); + AddTextPrinterParameterized(state->locWindowId, FONT_NARROW, mapName, x, 1, 0, NULL); } static void PrintMatchCallSelectionOptions(struct Pokenav4Struct *state) @@ -1023,7 +1023,7 @@ static void PrintMatchCallSelectionOptions(struct Pokenav4Struct *state) if (optionText == MATCH_CALL_OPTION_COUNT) break; - AddTextPrinterParameterized(state->infoBoxWindowId, 7, sMatchCallOptionTexts[optionText], 16, i * 16 + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(state->infoBoxWindowId, FONT_NARROW, sMatchCallOptionTexts[optionText], 16, i * 16 + 1, TEXT_SPEED_FF, NULL); } CopyWindowToVram(state->infoBoxWindowId, 2); @@ -1095,7 +1095,7 @@ static bool32 IsDma3ManagerBusyWithBgCopy2(struct Pokenav4Struct *state) static void PrintCallingDots(struct Pokenav4Struct *state) { - AddTextPrinterParameterized(state->msgBoxWindowId, 1, sText_CallingDots, 32, 1, 1, NULL); + AddTextPrinterParameterized(state->msgBoxWindowId, FONT_NORMAL, sText_CallingDots, 32, 1, 1, NULL); } static bool32 WaitForCallingDotsText(struct Pokenav4Struct *state) @@ -1106,7 +1106,7 @@ static bool32 WaitForCallingDotsText(struct Pokenav4Struct *state) static void PrintTrainerIsCloseBy(struct Pokenav4Struct *state) { - AddTextPrinterParameterized(state->msgBoxWindowId, 1, gText_TrainerCloseBy, 0, 1, 1, NULL); + AddTextPrinterParameterized(state->msgBoxWindowId, FONT_NORMAL, gText_TrainerCloseBy, 0, 1, 1, NULL); } static bool32 WaitForTrainerIsCloseByText(struct Pokenav4Struct *state) @@ -1120,7 +1120,7 @@ static void PrintMatchCallMessage(struct Pokenav4Struct *state) int index = GetSelectedPokenavListIndex(); const u8 *str = GetMatchCallMessageText(index, &state->unkF); u8 speed = GetPlayerTextSpeedDelay(); - AddTextPrinterParameterized(state->msgBoxWindowId, 1, str, 32, 1, speed, NULL); + AddTextPrinterParameterized(state->msgBoxWindowId, FONT_NORMAL, str, 32, 1, speed, NULL); } static bool32 WaitForMatchCallMessageText(struct Pokenav4Struct *state) diff --git a/src/pokenav_match_call_ui.c b/src/pokenav_match_call_ui.c index f022f04bf..5a6de2c00 100644 --- a/src/pokenav_match_call_ui.c +++ b/src/pokenav_match_call_ui.c @@ -733,7 +733,7 @@ void PrintMatchCallFieldNames(struct PokenavSub17Substruct *list, u32 fieldId) u32 top = (list->listWindow.unkA + 1 + (fieldId * 2)) & 0xF; FillWindowPixelRect(list->listWindow.windowId, PIXEL_FILL(1), 0, top << 4, list->listWindow.unk4, 16); - AddTextPrinterParameterized3(list->listWindow.windowId, 7, 2, (top << 4) + 1, colors, -1, fieldNames[fieldId]); + AddTextPrinterParameterized3(list->listWindow.windowId, FONT_NARROW, 2, (top << 4) + 1, colors, -1, fieldNames[fieldId]); CopyWindowRectToVram(list->listWindow.windowId, 2, 0, top << 1, list->listWindow.unk4, 2); } @@ -754,7 +754,7 @@ static void PrintMatchCallFlavorText(struct MatchCallWindowState *a0, struct Pok if (str != NULL) { FillWindowTilesByRow(list->listWindow.windowId, 1, r6 * 2, list->listWindow.unk4 - 1, 2); - AddTextPrinterParameterized(list->listWindow.windowId, 7, str, 2, (r6 << 4) + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(list->listWindow.windowId, FONT_NARROW, str, 2, (r6 << 4) + 1, TEXT_SPEED_FF, NULL); CopyWindowRectToVram(list->listWindow.windowId, 2, 0, r6 * 2, list->listWindow.unk4, 2); } } diff --git a/src/pokenav_menu_handler_2.c b/src/pokenav_menu_handler_2.c index 5f6c4460a..ded4c7007 100644 --- a/src/pokenav_menu_handler_2.c +++ b/src/pokenav_menu_handler_2.c @@ -1133,9 +1133,9 @@ static void PrintCurrentOptionDescription(void) struct Pokenav2Struct * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_ICONS); int menuItem = GetCurrentMenuItemId(); const u8 * s = sPageDescriptions[menuItem]; - u32 width = GetStringWidth(1, s, -1); + u32 width = GetStringWidth(FONT_NORMAL, s, -1); FillWindowPixelBuffer(ptr->optionDescWindowId, PIXEL_FILL(6)); - AddTextPrinterParameterized3(ptr->optionDescWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors, 0, s); + AddTextPrinterParameterized3(ptr->optionDescWindowId, FONT_NORMAL, (192 - width) / 2, 1, sOptionDescTextColors, 0, s); } // Printed when Ribbons is selected if no PC/party mons have ribbons @@ -1144,9 +1144,9 @@ static void PrintNoRibbonWinners(void) { struct Pokenav2Struct * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_ICONS); const u8 * s = gText_NoRibbonWinners; - u32 width = GetStringWidth(1, s, -1); + u32 width = GetStringWidth(FONT_NORMAL, s, -1); FillWindowPixelBuffer(ptr->optionDescWindowId, PIXEL_FILL(6)); - AddTextPrinterParameterized3(ptr->optionDescWindowId, 1, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s); + AddTextPrinterParameterized3(ptr->optionDescWindowId, FONT_NORMAL, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s); } static bool32 IsDma3ManagerBusyWithBgCopy_(void) diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index 13a7030da..07788a5d3 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -535,7 +535,7 @@ static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state) case MAPSECTYPE_CITY_CANFLY: FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1)); PutWindowRectTilemap(state->infoWindowId, 0, 0, 12, 2); - AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(state->infoWindowId, FONT_NARROW, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); DrawCityMap(state, regionMap->mapSecId, regionMap->posWithinMapSec); CopyWindowToVram(state->infoWindowId, 3); SetCityZoomTextInvisibility(FALSE); @@ -543,7 +543,7 @@ static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state) case MAPSECTYPE_CITY_CANTFLY: FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1)); PutWindowRectTilemap(state->infoWindowId, 0, 0, 12, 2); - AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(state->infoWindowId, FONT_NARROW, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); FillBgTilemapBufferRect(1, 0x1041, 17, 6, 12, 11, 17); CopyWindowToVram(state->infoWindowId, 3); SetCityZoomTextInvisibility(TRUE); @@ -552,7 +552,7 @@ static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state) case MAPSECTYPE_BATTLE_FRONTIER: FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1)); PutWindowTilemap(state->infoWindowId); - AddTextPrinterParameterized(state->infoWindowId, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(state->infoWindowId, FONT_NARROW, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL); PrintLandmarkNames(state, regionMap->mapSecId, regionMap->posWithinMapSec); CopyWindowToVram(state->infoWindowId, 3); SetCityZoomTextInvisibility(TRUE); @@ -654,7 +654,7 @@ static void PrintLandmarkNames(struct Pokenav5Struct_2 *state, int mapSecId, int break; StringCopyPadded(gStringVar1, landmarkName, CHAR_SPACE, 12); - AddTextPrinterParameterized(state->infoWindowId, 7, gStringVar1, 0, i * 16 + 17, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(state->infoWindowId, FONT_NARROW, gStringVar1, 0, i * 16 + 17, TEXT_SPEED_FF, NULL); i++; } } diff --git a/src/pokenav_ribbons_1.c b/src/pokenav_ribbons_1.c index a8aaafa35..3d8611a4a 100644 --- a/src/pokenav_ribbons_1.c +++ b/src/pokenav_ribbons_1.c @@ -673,8 +673,8 @@ static void sub_81D02B0(s32 windowId, s32 val1, s32 val2) ptr = ConvertIntToDecimalStringN(ptr, val1, STR_CONV_MODE_RIGHT_ALIGN, 3); *ptr++ = CHAR_SLASH; ConvertIntToDecimalStringN(ptr, val2, STR_CONV_MODE_RIGHT_ALIGN, 3); - x = GetStringCenterAlignXOffset(1, strbuf, 56); - AddTextPrinterParameterized(windowId, 1, strbuf, x, 1, 0xFF, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, strbuf, 56); + AddTextPrinterParameterized(windowId, FONT_NORMAL, strbuf, x, 1, 0xFF, NULL); } static void InitMonRibbonPokenavListMenuTemplate(void) @@ -689,7 +689,7 @@ static void InitMonRibbonPokenavListMenuTemplate(void) template.listTop = 1; template.maxShowed = 8; template.fillValue = 2; - template.fontId = 1; + template.fontId = FONT_NORMAL; template.listFunc.printMonFunc = BufferRibbonMonInfoText; template.unk14 = NULL; sub_81C81D4(&sMonRibbonListBgTemplates[1], &template, 0); @@ -722,7 +722,7 @@ static void BufferRibbonMonInfoText(struct PokenavMonList * item0, u8 * dest) } StringGetEnd10(gStringVar3); - dest = GetStringClearToWidth(dest, 1, gStringVar3, 60); + dest = GetStringClearToWidth(dest, FONT_NORMAL, gStringVar3, 60); switch (gender) { default: @@ -741,6 +741,6 @@ static void BufferRibbonMonInfoText(struct PokenavMonList * item0, u8 * dest) *s++ = CHAR_EXTRA_SYMBOL; *s++ = CHAR_LV_2; ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3); - dest = GetStringClearToWidth(dest, 1, gStringVar1, 54); + dest = GetStringClearToWidth(dest, FONT_NORMAL, gStringVar1, 54); ConvertIntToDecimalStringN(dest, item->data, STR_CONV_MODE_RIGHT_ALIGN, 2); } diff --git a/src/pokenav_ribbons_2.c b/src/pokenav_ribbons_2.c index bf1886ed0..75d9f5bd0 100644 --- a/src/pokenav_ribbons_2.c +++ b/src/pokenav_ribbons_2.c @@ -809,7 +809,7 @@ static void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_RibbonsF700); FillWindowPixelBuffer(structPtr->ribbonCountWindowId, PIXEL_FILL(4)); - AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, 1, 0, 1, color, -1, gStringVar4); + AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, 1, color, -1, gStringVar4); CopyWindowToVram(structPtr->ribbonCountWindowId, 2); } @@ -824,7 +824,7 @@ static void PrintRibbonNameAndDescription(struct PokenavSub14 *structPtr) { // Print normal ribbon name/description for (i = 0; i < 2; i++) - AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, 1, 0, (i * 16) + 1, color, -1, gRibbonDescriptionPointers[ribbonId][i]); + AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, -1, gRibbonDescriptionPointers[ribbonId][i]); } else { @@ -840,7 +840,7 @@ static void PrintRibbonNameAndDescription(struct PokenavSub14 *structPtr) // Print gift ribbon name/description ribbonId--; for (i = 0; i < 2; i++) - AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, 1, 0, (i * 16) + 1, color, -1, gGiftRibbonDescriptionPointers[ribbonId][i]); + AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, -1, gGiftRibbonDescriptionPointers[ribbonId][i]); } CopyWindowToVram(structPtr->ribbonCountWindowId, 2); @@ -877,7 +877,7 @@ static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr) FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); GetMonNicknameLevelGender(gStringVar3, &level, &gender); - AddTextPrinterParameterized(windowId, 1, gStringVar3, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar3, 0, 1, TEXT_SPEED_FF, NULL); switch (gender) { case MON_MALE: @@ -896,7 +896,7 @@ static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr) *(txtPtr++) = CHAR_EXTRA_SYMBOL; *(txtPtr++) = CHAR_LV_2; ConvertIntToDecimalStringN(txtPtr, level, STR_CONV_MODE_LEFT_ALIGN, 3); - AddTextPrinterParameterized(windowId, 1, gStringVar1, 60, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar1, 60, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(windowId, 2); } @@ -932,8 +932,8 @@ static void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr) txtPtr = ConvertIntToDecimalStringN(gStringVar1, id, STR_CONV_MODE_RIGHT_ALIGN, 3); *(txtPtr++) = CHAR_SLASH; ConvertIntToDecimalStringN(txtPtr, count, STR_CONV_MODE_RIGHT_ALIGN, 3); - x = GetStringCenterAlignXOffset(1, gStringVar1, 56); - AddTextPrinterParameterized(structPtr->listIdxWindowId, 1, gStringVar1, x, 1, TEXT_SPEED_FF, NULL); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar1, 56); + AddTextPrinterParameterized(structPtr->listIdxWindowId, FONT_NORMAL, gStringVar1, x, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(structPtr->listIdxWindowId, 2); } diff --git a/src/record_mixing.c b/src/record_mixing.c index 7ffe6680f..2197d8542 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -286,7 +286,7 @@ static void ReceiveExchangePacket(u32 multiplayerId) static void PrintTextOnRecordMixing(const u8 *src) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, src, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, src, 0, 1, 0, NULL); CopyWindowToVram(0, 3); } diff --git a/src/region_map.c b/src/region_map.c index 4e547b5fb..46539205b 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1718,7 +1718,7 @@ void CB2_OpenFlyMap(void) LoadPalette(sRegionMapFramePal, 0x10, 0x20); PutWindowTilemap(2); FillWindowPixelBuffer(2, PIXEL_FILL(0)); - AddTextPrinterParameterized(2, 1, gText_FlyToWhere, 0, 1, 0, NULL); + AddTextPrinterParameterized(2, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); gMain.state++; break; @@ -1784,9 +1784,9 @@ static void DrawFlyDestTextWindow(void) namePrinted = TRUE; ClearStdWindowAndFrameToTransparent(0, FALSE); DrawStdFrameWithCustomTileAndPalette(1, FALSE, 101, 13); - AddTextPrinterParameterized(1, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec]; - AddTextPrinterParameterized(1, 1, name, GetStringRightAlignXOffset(1, name, 96), 17, 0, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, name, GetStringRightAlignXOffset(FONT_NORMAL, name, 96), 17, 0, NULL); ScheduleBgCopyTilemapToVram(0); sDrawFlyDestTextWindow = TRUE; } @@ -1805,7 +1805,7 @@ static void DrawFlyDestTextWindow(void) // Window is already drawn, just empty it FillWindowPixelBuffer(0, PIXEL_FILL(1)); } - AddTextPrinterParameterized(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); sDrawFlyDestTextWindow = FALSE; } diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index 5e6fcd436..5fe1a6013 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -381,14 +381,14 @@ static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u ConvertIntToDecimalStringN(gStringVar1, seconds, STR_CONV_MODE_LEADING_ZEROS, 2); dest = StringCopy(dest, gStringVar1); - AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gStringVar4, x, y, TEXT_SPEED_FF, NULL); } static void ShowChooseTimeWindow(u8 windowId, u16 days, u8 hours, u8 minutes, u8 seconds) { DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, 0x214, 0xE); PrintTime(windowId, 0, 1, days, hours, minutes, seconds); - AddTextPrinterParameterized(windowId, 1, gText_Confirm2, 126, 1, 0, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_Confirm2, 126, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); } @@ -563,7 +563,7 @@ static void VBlankCB(void) static void ShowMessage(const u8 *str) { DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF); - AddTextPrinterParameterized(1, 1, str, 0, 1, 0, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, str, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); } @@ -578,7 +578,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId) case 0: DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x214, 0xE); - AddTextPrinterParameterized(0, 1, gText_PresentTime, 0, 1, TEXT_SPEED_FF, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_PresentTime, 0, 1, TEXT_SPEED_FF, 0); PrintTime( 0, 0, @@ -588,7 +588,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId) gLocalTime.minutes, gLocalTime.seconds); - AddTextPrinterParameterized(0, 1, gText_PreviousTime, 0, 33, TEXT_SPEED_FF, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_PreviousTime, 0, 33, TEXT_SPEED_FF, 0); PrintTime( 0, 0, diff --git a/src/roulette.c b/src/roulette.c index acfeea2b7..ea0f9332b 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -1223,7 +1223,7 @@ static void CB2_LoadRoulette(void) SetMultiplierSprite(SELECTION_NONE); DrawGridBackground(SELECTION_NONE); DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_ControlsInstruction, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_ControlsInstruction, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); gSpriteCoordOffsetX = -60; gSpriteCoordOffsetY = 0; @@ -1294,7 +1294,7 @@ static void Task_AskKeepPlaying(u8 taskId) { DisplayYesNoMenuDefaultYes(); DrawStdWindowFrame(sTextWindowId, 0); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_KeepPlaying, 0, 1, TEXT_SPEED_FF, 0); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_KeepPlaying, 0, 1, TEXT_SPEED_FF, 0); CopyWindowToVram(sTextWindowId, 3); DoYesNoFuncWithChoice(taskId, &sYesNoTable_KeepPlaying); } @@ -1806,14 +1806,14 @@ static void Task_PrintSpinResult(u8 taskId) { PlayFanfare(MUS_SLOTS_JACKPOT); DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_Jackpot, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_Jackpot, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); } else { PlayFanfare(MUS_SLOTS_WIN); DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_ItsAHit, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_ItsAHit, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); } break; @@ -1821,7 +1821,7 @@ static void Task_PrintSpinResult(u8 taskId) default: m4aSongNumStart(SE_FAILURE); DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_NothingDoing, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_NothingDoing, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); break; } @@ -1866,7 +1866,7 @@ static void Task_PrintPayout(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, (sRoulette->minBet * gTasks[taskId].tMultiplier), STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, Roulette_Text_YouveWonXCoins); DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); gTasks[taskId].tPayout = (sRoulette->minBet * gTasks[taskId].tMultiplier); gTasks[taskId].data[7] = 0; @@ -1902,7 +1902,7 @@ static void Task_TryPrintEndTurnMsg(u8 taskId) { // Reached Ball 6, clear board DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_BoardWillBeCleared, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_BoardWillBeCleared, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); StartTaskAfterDelayOrInput(taskId, Task_ClearBoard, NO_DELAY, A_BUTTON | B_BUTTON); } @@ -1910,7 +1910,7 @@ static void Task_TryPrintEndTurnMsg(u8 taskId) { // Player maxed out coins DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_CoinCaseIsFull, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_CoinCaseIsFull, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); StartTaskAfterDelayOrInput(taskId, Task_AskKeepPlaying, NO_DELAY, A_BUTTON | B_BUTTON); } @@ -1924,7 +1924,7 @@ static void Task_TryPrintEndTurnMsg(u8 taskId) { // Player out of coins DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_NoCoinsLeft, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_NoCoinsLeft, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); StartTaskAfterDelayOrInput(taskId, Task_StopPlaying, 60, A_BUTTON | B_BUTTON); } @@ -1949,7 +1949,7 @@ static void Task_ClearBoard(u8 taskId) if (gTasks[taskId].tCoins == MAX_COINS) { DrawStdWindowFrame(sTextWindowId, FALSE); - AddTextPrinterParameterized(sTextWindowId, 1, Roulette_Text_CoinCaseIsFull, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sTextWindowId, FONT_NORMAL, Roulette_Text_CoinCaseIsFull, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(sTextWindowId, 3); StartTaskAfterDelayOrInput(taskId, Task_AskKeepPlaying, NO_DELAY, A_BUTTON | B_BUTTON); } @@ -3426,7 +3426,7 @@ static void Task_PrintMinBet(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, minBet, STR_CONV_MODE_LEADING_ZEROS, 1); StringExpandPlaceholders(gStringVar4, Roulette_Text_PlayMinimumWagerIsX); DrawStdWindowFrame(0, FALSE); - AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_ShowMinBetYesNo; } @@ -3445,7 +3445,7 @@ static void Task_PrintRouletteEntryMsg(u8 taskId) { // Special rate for Game Corner service day (only at second table) DrawStdWindowFrame(0, FALSE); - AddTextPrinterParameterized(0, 1, Roulette_Text_SpecialRateTable, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, Roulette_Text_SpecialRateTable, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_PrintMinBet; } @@ -3454,7 +3454,7 @@ static void Task_PrintRouletteEntryMsg(u8 taskId) // Print minimum bet StringExpandPlaceholders(gStringVar4, Roulette_Text_PlayMinimumWagerIsX); DrawStdWindowFrame(0, FALSE); - AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_ShowMinBetYesNo; } @@ -3464,7 +3464,7 @@ static void Task_PrintRouletteEntryMsg(u8 taskId) // Not enough for minimum bet StringExpandPlaceholders(gStringVar4, Roulette_Text_NotEnoughCoins); DrawStdWindowFrame(0, FALSE); - AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_NotEnoughForMinBet; gTasks[taskId].tCoins = 0; diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index da75a4804..4f0373270 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -153,7 +153,7 @@ static void SaveFailedScreenTextPrint(const u8 *text, u8 x, u8 y) color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_6; color[2] = TEXT_COLOR_LIGHT_GRAY; - AddTextPrinterParameterized4(sWindowIds[TEXT_WIN_ID], 1, x * 8, y * 8 + 1, 0, 0, color, 0, text); + AddTextPrinterParameterized4(sWindowIds[TEXT_WIN_ID], FONT_NORMAL, x * 8, y * 8 + 1, 0, 0, color, 0, text); } void DoSaveFailedScreen(u8 saveType) diff --git a/src/scrcmd.c b/src/scrcmd.c index 96d95da27..57f133d0d 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1310,7 +1310,7 @@ bool8 ScrCmd_messageinstant(struct ScriptContext *ctx) msg = (const u8 *)ctx->data[0]; LoadMessageBoxAndBorderGfx(); DrawDialogueFrame(0, 1); - AddTextPrinterParameterized(0, 1, msg, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, msg, 0, 1, 0, 0); return FALSE; } @@ -1497,7 +1497,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) // in Emerald they are unused and position is calculated below instead StringExpandPlaceholders(gStringVar4, ptr + 6); - width = GetStringWidth(6, gStringVar4, -1) / 8u; + width = GetStringWidth(FONT_BRAILLE, gStringVar4, -1) / 8u; if (width > 28) width = 28; @@ -1532,7 +1532,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) DrawStdWindowFrame(gBrailleWindowId, 0); PutWindowTilemap(gBrailleWindowId); FillWindowPixelBuffer(gBrailleWindowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(gBrailleWindowId, 6, gStringVar4, xText, yText, 0xFF, 0x0); + AddTextPrinterParameterized(gBrailleWindowId, FONT_BRAILLE, gStringVar4, xText, yText, 0xFF, 0x0); CopyWindowToVram(gBrailleWindowId, 3); return FALSE; } diff --git a/src/script_menu.c b/src/script_menu.c index f3317773a..f0dccd9f9 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -353,22 +353,22 @@ static void CreatePCMultichoice(void) numChoices = 4; windowId = CreateWindowFromRect(0, 0, width, 8); SetStandardWindowBorderStyle(windowId, 0); - AddTextPrinterParameterized(windowId, 1, gText_HallOfFame, y, 33, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_LogOff, y, 49, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_HallOfFame, y, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_LogOff, y, 49, TEXT_SPEED_FF, NULL); } else { numChoices = 3; windowId = CreateWindowFromRect(0, 0, width, 6); SetStandardWindowBorderStyle(windowId, 0); - AddTextPrinterParameterized(windowId, 1, gText_LogOff, y, 33, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_LogOff, y, 33, TEXT_SPEED_FF, NULL); } // Change PC name if player has met Lanette if (FlagGet(FLAG_SYS_PC_LANETTE)) - AddTextPrinterParameterized(windowId, 1, gText_LanettesPC, y, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_LanettesPC, y, 1, TEXT_SPEED_FF, NULL); else - AddTextPrinterParameterized(windowId, 1, gText_SomeonesPC, y, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_SomeonesPC, y, 1, TEXT_SPEED_FF, NULL); StringExpandPlaceholders(gStringVar4, gText_PlayersPC); PrintPlayerNameOnWindow(windowId, gStringVar4, y, 17); @@ -380,7 +380,7 @@ static void CreatePCMultichoice(void) void ScriptMenu_DisplayPCStartupPrompt(void) { sub_819786C(0, TRUE); - AddTextPrinterParameterized2(0, 1, gText_WhichPCShouldBeAccessed, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, gText_WhichPCShouldBeAccessed, 0, NULL, 2, 1, 3); } bool8 ScriptMenu_CreateLilycoveSSTidalMultichoice(void) @@ -414,7 +414,7 @@ static void CreateLilycoveSSTidalMultichoice(void) sLilycoveSSTidalSelections[i] = 0xFF; } - GetFontAttribute(1, FONTATTR_MAX_LETTER_WIDTH); + GetFontAttribute(FONT_NORMAL, FONTATTR_MAX_LETTER_WIDTH); if (gSpecialVar_0x8004 == 0) { @@ -527,7 +527,7 @@ static void CreateLilycoveSSTidalMultichoice(void) { if (sLilycoveSSTidalSelections[i] != 0xFF) { - AddTextPrinterParameterized(windowId, 1, sLilycoveSSTidalDestinations[sLilycoveSSTidalSelections[i]], 8, selectionCount * 16 + 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, sLilycoveSSTidalDestinations[sLilycoveSSTidalSelections[i]], 8, selectionCount * 16 + 1, TEXT_SPEED_FF, NULL); selectionCount++; } } @@ -645,27 +645,27 @@ static void DrawLinkServicesMultichoiceMenu(u8 multichoiceId) { case MULTI_WIRELESS_NO_BERRY: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sWirelessOptionsNoBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sWirelessOptionsNoBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case MULTI_CABLE_CLUB_WITH_RECORD_MIX: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sCableClubOptions_WithRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sCableClubOptions_WithRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case MULTI_WIRELESS_NO_RECORD: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sWirelessOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sWirelessOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case MULTI_WIRELESS_ALL_SERVICES: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sWirelessOptions_AllServices[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sWirelessOptions_AllServices[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case MULTI_WIRELESS_NO_RECORD_BERRY: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sWirelessOptions_NoRecordMixBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sWirelessOptions_NoRecordMixBerryCrush[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case MULTI_CABLE_CLUB_NO_RECORD_MIX: FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, sCableClubOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, FONT_NORMAL, sCableClubOptions_NoRecordMix[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; } } @@ -688,15 +688,15 @@ static void CreateStartMenuForPokenavTutorial(void) { u8 windowId = CreateWindowFromRect(21, 0, 7, 18); SetStandardWindowBorderStyle(windowId, 0); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionPokedex, 8, 9, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionPokemon, 8, 25, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionBag, 8, 41, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionPokenav, 8, 57, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gSaveBlock2Ptr->playerName, 8, 73, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionSave, 8, 89, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionOption, 8, 105, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(windowId, 1, gText_MenuOptionExit, 8, 121, TEXT_SPEED_FF, NULL); - sub_81983AC(windowId, 1, 0, 9, 16, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), 0); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionPokedex, 8, 9, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionPokemon, 8, 25, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionBag, 8, 41, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionPokenav, 8, 57, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gSaveBlock2Ptr->playerName, 8, 73, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionSave, 8, 89, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionOption, 8, 105, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_MenuOptionExit, 8, 121, TEXT_SPEED_FF, NULL); + sub_81983AC(windowId, FONT_NORMAL, 0, 9, 16, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), 0); InitMultichoiceNoWrap(FALSE, ARRAY_COUNT(MultichoiceList_ForcedStartMenu), windowId, MULTI_FORCED_START_MENU); CopyWindowToVram(windowId, 3); } @@ -727,7 +727,7 @@ static int DisplayTextAndGetWidthInternal(const u8 *str) { u8 temp[64]; StringExpandPlaceholders(temp, str); - return GetStringWidth(1, temp, 0); + return GetStringWidth(FONT_NORMAL, temp, 0); } int DisplayTextAndGetWidth(const u8 *str, int prevWidth) diff --git a/src/secret_base.c b/src/secret_base.c index e728f3488..12f6df5ab 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -214,7 +214,7 @@ static const struct ListMenuTemplate sRegistryListMenuTemplate = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, - .fontId = 1, + .fontId = FONT_NORMAL, .cursorKind = 0, }; diff --git a/src/shop.c b/src/shop.c index f4e3fa2d8..817146d78 100755 --- a/src/shop.c +++ b/src/shop.c @@ -152,7 +152,7 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate = .lettersSpacing = 0, .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, - .fontId = 7, + .fontId = FONT_NARROW, .cursorKind = 0 }; @@ -576,8 +576,8 @@ static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y) } StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1); - x = GetStringRightAlignXOffset(7, gStringVar4, 0x78); - AddTextPrinterParameterized4(windowId, 7, x, y, 0, 0, sShopBuyMenuTextColors[1], -1, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 0x78); + AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, 0, 0, sShopBuyMenuTextColors[1], -1, gStringVar4); } } @@ -692,12 +692,12 @@ static void BuyMenuInitWindows(void) static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 colorSet) { - AddTextPrinterParameterized4(windowId, 1, x, y, 0, 0, sShopBuyMenuTextColors[colorSet], speed, text); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, 0, sShopBuyMenuTextColors[colorSet], speed, text); } static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback) { - DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeedDelay(), text, callback); + DisplayMessageAndContinueTask(taskId, 5, 10, 14, FONT_NORMAL, GetPlayerTextSpeedDelay(), text, callback); ScheduleBgCopyTilemapToVram(0); } diff --git a/src/slot_machine.c b/src/slot_machine.c index af55e0d9b..7d4610273 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1253,7 +1253,7 @@ static bool8 SlotAction_HandleBetInput(struct Task *task) static bool8 SlotAction_PrintMsg_Need3Coins(struct Task *task) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); sSlotMachine->state = SLOT_ACTION_WAIT_MSG_NEED_3_COINS; return FALSE; @@ -1518,7 +1518,7 @@ static bool8 SlotAction_NoMatches(struct Task *task) static bool8 SlotAction_AskQuit(struct Task *task) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, gText_QuitTheGame, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0); CopyWindowToVram(0, 3); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); sSlotMachine->state = SLOT_ACTION_HANDLE_QUIT_INPUT; @@ -1550,7 +1550,7 @@ static bool8 SlotAction_HandleQuitInput(struct Task *task) static bool8 SlotAction_PrintMsg_9999Coins(struct Task *task) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, gText_YouveGot9999Coins, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0); CopyWindowToVram(0, 3); sSlotMachine->state = SLOT_ACTION_WAIT_MSG_MAX_COINS; return FALSE; @@ -1571,7 +1571,7 @@ static bool8 SlotAction_WaitMsg_9999Coins(struct Task *task) static bool8 SlotAction_PrintMsg_NoMoreCoins(struct Task *task) { DrawDialogueFrame(0, 0); - AddTextPrinterParameterized(0, 1, gText_YouveRunOutOfCoins, 0, 1, 0, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); sSlotMachine->state = SLOT_ACTION_WAIT_MSG_NO_MORE_COINS; return FALSE; @@ -3444,7 +3444,7 @@ static void InfoBox_DrawWindow(struct Task *task) static void InfoBox_AddText(struct Task *task) { - AddTextPrinterParameterized3(1, 1, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); + AddTextPrinterParameterized3(1, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); CopyWindowToVram(1, 3); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); task->tState++; diff --git a/src/start_menu.c b/src/start_menu.c index 236c6e404..dcff75ff6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -386,7 +386,7 @@ static void ShowSafariBallsWindow(void) DrawStdWindowFrame(sSafariBallsWindowId, FALSE); ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_SafariBallStock); - AddTextPrinterParameterized(sSafariBallsWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL); + AddTextPrinterParameterized(sSafariBallsWindowId, FONT_NORMAL, gStringVar4, 0, 1, 0xFF, NULL); CopyWindowToVram(sSafariBallsWindowId, 2); } @@ -401,7 +401,7 @@ static void ShowPyramidFloorWindow(void) DrawStdWindowFrame(sBattlePyramidFloorWindowId, FALSE); StringCopy(gStringVar1, sPyramidFloorNames[gSaveBlock2Ptr->frontier.curChallengeBattleNum]); StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor); - AddTextPrinterParameterized(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL); + AddTextPrinterParameterized(sBattlePyramidFloorWindowId, FONT_NORMAL, gStringVar4, 0, 1, 0xFF, NULL); CopyWindowToVram(sBattlePyramidFloorWindowId, 2); } @@ -433,7 +433,7 @@ static bool32 PrintStartMenuActions(s8 *pIndex, u32 count) else { StringExpandPlaceholders(gStringVar4, sStartMenuItems[sCurrentStartMenuActions[index]].text); - AddTextPrinterParameterized(GetStartMenuWindowId(), 1, gStringVar4, 8, (index << 4) + 9, 0xFF, NULL); + AddTextPrinterParameterized(GetStartMenuWindowId(), FONT_NORMAL, gStringVar4, 8, (index << 4) + 9, 0xFF, NULL); } index++; @@ -482,7 +482,7 @@ static bool32 InitStartMenuStep(void) sInitStartMenuData[0]++; break; case 5: - sStartMenuCursorPos = sub_81983AC(GetStartMenuWindowId(), 1, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); + sStartMenuCursorPos = sub_81983AC(GetStartMenuWindowId(), FONT_NORMAL, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); CopyWindowToVram(GetStartMenuWindowId(), TRUE); return TRUE; } @@ -1238,7 +1238,7 @@ static void Task_SaveAfterLinkBattle(u8 taskId) case 0: FillWindowPixelBuffer(0, PIXEL_FILL(1)); AddTextPrinterParameterized2(0, - 1, + FONT_NORMAL, gText_SavingDontTurnOffPower, TEXT_SPEED_FF, NULL, @@ -1330,38 +1330,38 @@ static void ShowSaveInfoWindow(void) // Print region name yOffset = 1; BufferSaveMenuText(SAVE_MENU_LOCATION, gStringVar4, TEXT_COLOR_GREEN); - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gStringVar4, 0, yOffset, 0xFF, NULL); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gStringVar4, 0, yOffset, 0xFF, NULL); // Print player name yOffset += 16; - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gText_SavingPlayer, 0, yOffset, 0xFF, NULL); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gText_SavingPlayer, 0, yOffset, 0xFF, NULL); BufferSaveMenuText(SAVE_MENU_NAME, gStringVar4, color); - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x70); PrintPlayerNameOnWindow(sSaveInfoWindowId, gStringVar4, xOffset, yOffset); // Print badge count yOffset += 16; - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gText_SavingBadges, 0, yOffset, 0xFF, NULL); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gText_SavingBadges, 0, yOffset, 0xFF, NULL); BufferSaveMenuText(SAVE_MENU_BADGES, gStringVar4, color); - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x70); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gStringVar4, xOffset, yOffset, 0xFF, NULL); if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE) { // Print pokedex count yOffset += 16; - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gText_SavingPokedex, 0, yOffset, 0xFF, NULL); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gText_SavingPokedex, 0, yOffset, 0xFF, NULL); BufferSaveMenuText(SAVE_MENU_CAUGHT, gStringVar4, color); - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x70); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gStringVar4, xOffset, yOffset, 0xFF, NULL); } // Print play time yOffset += 16; - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gText_SavingTime, 0, yOffset, 0xFF, NULL); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gText_SavingTime, 0, yOffset, 0xFF, NULL); BufferSaveMenuText(SAVE_MENU_PLAY_TIME, gStringVar4, color); - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); - AddTextPrinterParameterized(sSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x70); + AddTextPrinterParameterized(sSaveInfoWindowId, FONT_NORMAL, gStringVar4, xOffset, yOffset, 0xFF, NULL); CopyWindowToVram(sSaveInfoWindowId, 2); } diff --git a/src/starter_choose.c b/src/starter_choose.c index d14846130..942f60273 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -480,7 +480,7 @@ static void Task_StarterChoose(u8 taskId) { CreateStarterPokemonLabel(gTasks[taskId].tStarterSelection); DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x2A8, 0xD); - AddTextPrinterParameterized(0, 1, gText_BirchInTrouble, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_BirchInTrouble, 0, 1, 0, NULL); PutWindowTilemap(0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = Task_HandleStarterChooseInput; @@ -534,7 +534,7 @@ static void Task_AskConfirmStarter(u8 taskId) { PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized(0, 1, gText_ConfirmStarterChoice, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_ConfirmStarterChoice, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); CreateYesNoMenu(&sWindowTemplate_ConfirmStarter, 0x2A8, 0xD, 0); gTasks[taskId].func = Task_HandleConfirmStarterInput; @@ -591,11 +591,11 @@ static void CreateStarterPokemonLabel(u8 selection) sStarterLabelWindowId = AddWindow(&winTemplate); FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0)); - width = GetStringCenterAlignXOffset(7, categoryText, 0x68); - AddTextPrinterParameterized3(sStarterLabelWindowId, 7, width, 1, sTextColors, 0, categoryText); + width = GetStringCenterAlignXOffset(FONT_NARROW, categoryText, 0x68); + AddTextPrinterParameterized3(sStarterLabelWindowId, FONT_NARROW, width, 1, sTextColors, 0, categoryText); - width = GetStringCenterAlignXOffset(1, speciesName, 0x68); - AddTextPrinterParameterized3(sStarterLabelWindowId, 1, width, 17, sTextColors, 0, speciesName); + width = GetStringCenterAlignXOffset(FONT_NORMAL, speciesName, 0x68); + AddTextPrinterParameterized3(sStarterLabelWindowId, FONT_NORMAL, width, 17, sTextColors, 0, speciesName); PutWindowTilemap(sStarterLabelWindowId); ScheduleBgCopyTilemapToVram(0); diff --git a/src/strings.c b/src/strings.c index ae39e3d4d..3785766ce 100644 --- a/src/strings.c +++ b/src/strings.c @@ -839,17 +839,17 @@ const u8 gText_B4F[] = _("B4F"); const u8 gText_Rooftop[] = _("ROOFTOP"); const u8 gText_ElevatorNowOn[] = _("Now on:"); const u8 gText_BP[] = _("BP"); -const u8 gText_EnergyPowder50[] = _("ENERGYPOWDER{CLEAR_TO 0x72}{FONT 0}50"); -const u8 gText_EnergyRoot80[] = _("ENERGY ROOT{CLEAR_TO 0x72}{FONT 0}80"); -const u8 gText_HealPowder50[] = _("HEAL POWDER{CLEAR_TO 0x72}{FONT 0}50"); -const u8 gText_RevivalHerb300[] = _("REVIVAL HERB{CLEAR_TO 0x6C}{FONT 0}300"); -const u8 gText_Protein1000[] = _("PROTEIN{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_Iron1000[] = _("IRON{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_Carbos1000[] = _("CARBOS{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_Calcium1000[] = _("CALCIUM{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_Zinc1000[] = _("ZINC{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_HPUp1000[] = _("HP UP{CLEAR_TO 0x63}{FONT 0}1,000"); -const u8 gText_PPUp3000[] = _("PP UP{CLEAR_TO 0x63}{FONT 0}3,000"); +const u8 gText_EnergyPowder50[] = _("ENERGYPOWDER{CLEAR_TO 114}{FONT_SMALL}50"); +const u8 gText_EnergyRoot80[] = _("ENERGY ROOT{CLEAR_TO 114}{FONT_SMALL}80"); +const u8 gText_HealPowder50[] = _("HEAL POWDER{CLEAR_TO 114}{FONT_SMALL}50"); +const u8 gText_RevivalHerb300[] = _("REVIVAL HERB{CLEAR_TO 108}{FONT_SMALL}300"); +const u8 gText_Protein1000[] = _("PROTEIN{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_Iron1000[] = _("IRON{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_Carbos1000[] = _("CARBOS{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_Calcium1000[] = _("CALCIUM{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_Zinc1000[] = _("ZINC{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_HPUp1000[] = _("HP UP{CLEAR_TO 99}{FONT_SMALL}1,000"); +const u8 gText_PPUp3000[] = _("PP UP{CLEAR_TO 99}{FONT_SMALL}3,000"); const u8 gText_RankingHall[] = _("RANKING HALL"); const u8 gText_ExchangeService[] = _("EXCHANGE SERVICE"); const u8 gText_LilycoveCity[] = _("LILYCOVE CITY"); diff --git a/src/tileset_anims.c b/src/tileset_anims.c index f566fe3e0..71f8044f9 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -1169,7 +1169,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) { CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32); BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != TASK_NONE) + if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) != TASK_NONE) { sSecondaryTilesetAnimCallback = TilesetAnim_BattleDome2; sSecondaryTilesetAnimCounterMax = 32; @@ -1179,7 +1179,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer) { CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32); - if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE) + if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE) { BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); if (!--sSecondaryTilesetAnimCounterMax) diff --git a/src/trade.c b/src/trade.c index 566bb14f3..475b82d5e 100644 --- a/src/trade.c +++ b/src/trade.c @@ -542,7 +542,7 @@ static void CB2_CreateTradeMenu(void) break; case 12: // Create player's name text sprites - xPos = GetStringCenterAlignXOffset(1, gSaveBlock2Ptr->playerName, 120); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gSaveBlock2Ptr->playerName, 120); for (i = 0; i < GFXTAG_PLAYER_NAME; i++) { temp = sSpriteTemplate_MenuText; @@ -551,7 +551,7 @@ static void CB2_CreateTradeMenu(void) } // Create partner's name text sprites - xPos = GetStringCenterAlignXOffset(1, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); for (i = 0; i < GFXTAG_PARTNER_NAME; i++) { temp = sSpriteTemplate_MenuText; @@ -733,7 +733,7 @@ static void CB2_ReturnToTradeMenu(void) break; case 12: // Create player's name text sprites - xPos = GetStringCenterAlignXOffset(1, gSaveBlock2Ptr->playerName, 120); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gSaveBlock2Ptr->playerName, 120); for (i = 0; i < GFXTAG_PLAYER_NAME; i++) { temp = sSpriteTemplate_MenuText; @@ -742,7 +742,7 @@ static void CB2_ReturnToTradeMenu(void) } // Create partner's name text sprites - xPos = GetStringCenterAlignXOffset(1, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); for (i = 0; i < GFXTAG_PARTNER_NAME; i++) { temp = sSpriteTemplate_MenuText; @@ -1851,9 +1851,9 @@ static void DrawTradeMenuParty(u8 whichParty) gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].x2 = 0; gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].y2 = 0; nameStringWidth = GetMonNicknameWidth(nickname, selectedMonParty, partyIdx); - AddTextPrinterParameterized3((whichParty * 2) + 14, 0, (80 - nameStringWidth) / 2, 4, sTradeTextColors, 0, nickname); + AddTextPrinterParameterized3((whichParty * 2) + 14, FONT_SMALL, (80 - nameStringWidth) / 2, 4, sTradeTextColors, 0, nickname); BufferTradeMonMoves(movesString, selectedMonParty, partyIdx); - AddTextPrinterParameterized4((whichParty * 2) + 15, 1, 0, 0, 0, 0, sTradeTextColors, 0, movesString); + AddTextPrinterParameterized4((whichParty * 2) + 15, FONT_NORMAL, 0, 0, 0, 0, sTradeTextColors, 0, movesString); PutWindowTilemap((whichParty * 2) + 14); CopyWindowToVram((whichParty * 2) + 14, 3); PutWindowTilemap((whichParty * 2) + 15); @@ -1881,7 +1881,7 @@ static u8 GetMonNicknameWidth(u8 *str, u8 whichParty, u8 monIdx) GetMonData(&gEnemyParty[monIdx], MON_DATA_NICKNAME, nickname); StringCopy10(str, nickname); - return GetStringWidth(0, str, GetFontAttribute(0, FONTATTR_LETTER_SPACING)); + return GetStringWidth(FONT_SMALL, str, GetFontAttribute(FONT_SMALL, FONTATTR_LETTER_SPACING)); } static void BufferTradeMonMoves(u8 *str, u8 whichParty, u8 partyIdx) @@ -1926,8 +1926,8 @@ static void PrintMonNicknameForTradeMenu(u8 whichParty, u8 windowId, u8 *nicknam { u8 xPos; windowId += (whichParty * PARTY_SIZE) + 2; - xPos = GetStringCenterAlignXOffset(0, nickname, 64); - AddTextPrinterParameterized3(windowId, 0, xPos, 4, sTradeTextColors, 0, nickname); + xPos = GetStringCenterAlignXOffset(FONT_SMALL, nickname, 64); + AddTextPrinterParameterized3(windowId, FONT_SMALL, xPos, 4, sTradeTextColors, 0, nickname); PutWindowTilemap(windowId); CopyWindowToVram(windowId, 3); } @@ -2153,7 +2153,7 @@ static void DoQueuedActions(void) static void PrintTradeMessage(u8 messageId) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized(0, 1, sTradeMessages[messageId], 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, sTradeMessages[messageId], 0, 1, TEXT_SPEED_FF, NULL); DrawTextBorderOuter(0, 20, 12); PutWindowTilemap(0); CopyWindowToVram(0, 3); @@ -4833,7 +4833,7 @@ void DrawTextOnTradeWindow(u8 windowId, const u8 *str, u8 speed) sTradeData->textColors[0] = TEXT_DYNAMIC_COLOR_6; sTradeData->textColors[1] = TEXT_COLOR_WHITE; sTradeData->textColors[2] = TEXT_COLOR_GREEN; - AddTextPrinterParameterized4(windowId, 1, 0, 2, 0, 0, sTradeData->textColors, speed, str); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, 2, 0, 0, sTradeData->textColors, speed, str); CopyWindowToVram(windowId, 3); } diff --git a/src/trader.c b/src/trader.c index 98b4f464c..c65d5ff87 100644 --- a/src/trader.c +++ b/src/trader.c @@ -59,15 +59,15 @@ void CreateAvailableDecorationsMenu(u8 taskId) s16 * data = gTasks[taskId].data; struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader; struct WindowTemplate windowTemplate = {0, 1, 1, 10, 10, 15, 1}; - s32 windowWidth = GetStringWidth(1, gText_Exit, 0); - s32 fiveMarksWidth = GetStringWidth(1, gText_FiveMarks, 0); + s32 windowWidth = GetStringWidth(FONT_NORMAL, gText_Exit, 0); + s32 fiveMarksWidth = GetStringWidth(FONT_NORMAL, gText_FiveMarks, 0); for (i = 0; i < 4; i++) { s32 curWidth; if (trader->decorations[i] > NUM_DECORATIONS) curWidth = fiveMarksWidth; else - curWidth = GetStringWidth(1, gDecorations[trader->decorations[i]].name, 0); + curWidth = GetStringWidth(FONT_NORMAL, gDecorations[trader->decorations[i]].name, 0); if (curWidth > windowWidth) windowWidth = curWidth; } @@ -77,11 +77,11 @@ void CreateAvailableDecorationsMenu(u8 taskId) for (i = 0; i < 4; i++) { if (trader->decorations[i] > NUM_DECORATIONS) - AddTextPrinterParameterized(data[3], 1, gText_FiveMarks, 8, 16 * i + 1, 255, NULL); + AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_FiveMarks, 8, 16 * i + 1, 255, NULL); else - AddTextPrinterParameterized(data[3], 1, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, 255, NULL); + AddTextPrinterParameterized(data[3], FONT_NORMAL, gDecorations[trader->decorations[i]].name, 8, 16 * i + 1, 255, NULL); } - AddTextPrinterParameterized(data[3], 1, gText_Exit, 8, 16 * i + 1, 255, NULL); + AddTextPrinterParameterized(data[3], FONT_NORMAL, gText_Exit, 8, 16 * i + 1, 255, NULL); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[3], 5, 0); ScheduleBgCopyTilemapToVram(0); } diff --git a/src/trainer_card.c b/src/trainer_card.c index 45902e7f8..6ebd61576 100755 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -497,7 +497,7 @@ static void Task_TrainerCard(u8 taskId) case STATE_WAIT_LINK_PARTNER: SetCloseLinkCallback(); DrawDialogueFrame(0, 1); - AddTextPrinterParameterized(0, 1, gText_WaitingTrainerFinishReading, 0, 1, 255, 0); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_WaitingTrainerFinishReading, 0, 1, 255, 0); CopyWindowToVram(0, 3); sData->mainState = STATE_CLOSE_CARD_LINK; break; @@ -1001,9 +1001,9 @@ static void PrintNameOnCardFront(void) StringCopy(txtPtr, sData->trainerCard.playerName); ConvertInternationalString(txtPtr, sData->language); if (sData->cardType == CARD_TYPE_FRLG) - AddTextPrinterParameterized3(1, 1, 20, 28, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); + AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 28, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); else - AddTextPrinterParameterized3(1, 1, 16, 33, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); + AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 33, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); } static void PrintIdOnCard(void) @@ -1016,16 +1016,16 @@ static void PrintIdOnCard(void) ConvertIntToDecimalStringN(txtPtr, sData->trainerCard.trainerId, STR_CONV_MODE_LEADING_ZEROS, 5); if (sData->cardType == CARD_TYPE_FRLG) { - xPos = GetStringCenterAlignXOffset(1, buffer, 80) + 132; + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, buffer, 80) + 132; top = 9; } else { - xPos = GetStringCenterAlignXOffset(1, buffer, 96) + 120; + xPos = GetStringCenterAlignXOffset(FONT_NORMAL, buffer, 96) + 120; top = 9; } - AddTextPrinterParameterized3(1, 1, xPos, top, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); + AddTextPrinterParameterized3(1, FONT_NORMAL, xPos, top, sTrainerCardTextColors, TEXT_SPEED_FF, buffer); } static void PrintMoneyOnCard(void) @@ -1034,23 +1034,23 @@ static void PrintMoneyOnCard(void) u8 top; if (!sData->isHoenn) - AddTextPrinterParameterized3(1, 1, 20, 56, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardMoney); + AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 56, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardMoney); else - AddTextPrinterParameterized3(1, 1, 16, 57, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardMoney); + AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 57, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardMoney); ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.money, STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1); if (!sData->isHoenn) { - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 144); top = 56; } else { - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 128); top = 57; } - AddTextPrinterParameterized3(1, 1, xOffset, top, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(1, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); } static u16 GetCaughtMonsCount(void) @@ -1068,21 +1068,21 @@ static void PrintPokedexOnCard(void) if (FlagGet(FLAG_SYS_POKEDEX_GET)) { if (!sData->isHoenn) - AddTextPrinterParameterized3(1, 1, 20, 72, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardPokedex); + AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 72, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardPokedex); else - AddTextPrinterParameterized3(1, 1, 16, 73, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardPokedex); + AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 73, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardPokedex); StringCopy(ConvertIntToDecimalStringN(gStringVar4, sData->trainerCard.caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3), gText_EmptyString6); if (!sData->isHoenn) { - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 144); top = 72; } else { - xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 128); top = 73; } - AddTextPrinterParameterized3(1, 1, xOffset, top, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(1, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); } } @@ -1096,9 +1096,9 @@ static void PrintTimeOnCard(void) u32 x, y, totalWidth; if (!sData->isHoenn) - AddTextPrinterParameterized3(1, 1, 20, 88, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardTime); + AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 88, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardTime); else - AddTextPrinterParameterized3(1, 1, 16, 89, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardTime); + AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 89, sTrainerCardTextColors, TEXT_SPEED_FF, gText_TrainerCardTime); if (sData->isLink) { @@ -1115,7 +1115,7 @@ static void PrintTimeOnCard(void) hours = 999; if (minutes > 59) minutes = 59; - width = GetStringWidth(1, gText_Colon2, 0); + width = GetStringWidth(FONT_NORMAL, gText_Colon2, 0); if (!sData->isHoenn) { @@ -1132,12 +1132,12 @@ static void PrintTimeOnCard(void) FillWindowPixelRect(1, PIXEL_FILL(0), x, y, totalWidth, 15); ConvertIntToDecimalStringN(gStringVar4, hours, STR_CONV_MODE_RIGHT_ALIGN, 3); - AddTextPrinterParameterized3(1, 1, x, y, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); x += 18; - AddTextPrinterParameterized3(1, 1, x, y, sTimeColonTextColors[sData->timeColonInvisible], TEXT_SPEED_FF, gText_Colon2); + AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTimeColonTextColors[sData->timeColonInvisible], TEXT_SPEED_FF, gText_Colon2); x += width; ConvertIntToDecimalStringN(gStringVar4, minutes, STR_CONV_MODE_LEADING_ZEROS, 2); - AddTextPrinterParameterized3(1, 1, x, y, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SPEED_FF, gStringVar4); } static void PrintProfilePhraseOnCard(void) @@ -1147,10 +1147,10 @@ static void PrintProfilePhraseOnCard(void) if (sData->isLink) { - AddTextPrinterParameterized3(1, 1, 8, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[0]); - AddTextPrinterParameterized3(1, 1, GetStringWidth(1, sData->easyChatProfile[0], 0) + 14, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[1]); - AddTextPrinterParameterized3(1, 1, 8, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[2]); - AddTextPrinterParameterized3(1, 1, GetStringWidth(1, sData->easyChatProfile[2], 0) + 14, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[3]); + AddTextPrinterParameterized3(1, FONT_NORMAL, 8, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[0]); + AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[0], 0) + 14, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[1]); + AddTextPrinterParameterized3(1, FONT_NORMAL, 8, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[2]); + AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[2], 0) + 14, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SPEED_FF, sData->easyChatProfile[3]); } } @@ -1168,9 +1168,9 @@ static void BufferNameForCardBack(void) static void PrintNameOnCardBack(void) { if (!sData->isHoenn) - AddTextPrinterParameterized3(1, 1, 136, 9, sTrainerCardTextColors, TEXT_SPEED_FF, sData->textPlayersCard); + AddTextPrinterParameterized3(1, FONT_NORMAL, 136, 9, sTrainerCardTextColors, TEXT_SPEED_FF, sData->textPlayersCard); else - AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, sData->textPlayersCard, 216), 9, sTrainerCardTextColors, TEXT_SPEED_FF, sData->textPlayersCard); + AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, sData->textPlayersCard, 216), 9, sTrainerCardTextColors, TEXT_SPEED_FF, sData->textPlayersCard); } static const u8 sText_HofTime[] = _("{STR_VAR_1}:{STR_VAR_2}:{STR_VAR_3}"); @@ -1191,8 +1191,8 @@ static void PrintStatOnBackOfCard(u8 top, const u8* statName, u8* stat, const u8 static const u8 xOffsets[] = {8, 16}; static const u8 widths[] = {216, 216}; - AddTextPrinterParameterized3(1, 1, xOffsets[sData->isHoenn], top * 16 + 33, sTrainerCardTextColors, TEXT_SPEED_FF, statName); - AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, stat, widths[sData->isHoenn]), top * 16 + 33, color, TEXT_SPEED_FF, stat); + AddTextPrinterParameterized3(1, FONT_NORMAL, xOffsets[sData->isHoenn], top * 16 + 33, sTrainerCardTextColors, TEXT_SPEED_FF, statName); + AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, stat, widths[sData->isHoenn]), top * 16 + 33, color, TEXT_SPEED_FF, stat); } static void PrintHofDebutTimeOnCard(void) diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 34fa24f74..621f81133 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -590,13 +590,13 @@ void PrintOnTrainerHillRecordsWindow(void) SetUpDataStruct(); FillWindowPixelBuffer(0, PIXEL_FILL(0)); - x = GetStringCenterAlignXOffset(1, gText_TimeBoard, 0xD0); - AddTextPrinterParameterized3(0, 1, x, 2, sRecordWinColors, TEXT_SPEED_FF, gText_TimeBoard); + x = GetStringCenterAlignXOffset(FONT_NORMAL, gText_TimeBoard, 0xD0); + AddTextPrinterParameterized3(0, FONT_NORMAL, x, 2, sRecordWinColors, TEXT_SPEED_FF, gText_TimeBoard); y = 18; for (i = 0; i < 4; i++) { - AddTextPrinterParameterized3(0, 1, 0, y, sRecordWinColors, TEXT_SPEED_FF, sTagMatchStrings[i]); + AddTextPrinterParameterized3(0, FONT_NORMAL, 0, y, sRecordWinColors, TEXT_SPEED_FF, sTagMatchStrings[i]); y += 15; total = GetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i]); minutes = total / (60 * 60); @@ -608,8 +608,8 @@ void PrintOnTrainerHillRecordsWindow(void) secondsFraction = (total * 168) / 100; ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(StringCopy(gStringVar4, gText_TimeCleared), gText_XMinYDotZSec); - x = GetStringRightAlignXOffset(1, gStringVar4, 0xD0); - AddTextPrinterParameterized3(0, 1, x, y, sRecordWinColors, TEXT_SPEED_FF, gStringVar4); + x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0xD0); + AddTextPrinterParameterized3(0, FONT_NORMAL, x, y, sRecordWinColors, TEXT_SPEED_FF, gStringVar4); y += 17; } diff --git a/src/union_room.c b/src/union_room.c index 18cb02c33..5196c1cdb 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3982,7 +3982,7 @@ static void PrintGroupMemberOnWindow(u8 windowId, u8 x, u8 y, struct RfuPlayer * ConvertIntToDecimalStringN(trainerId, player->rfu.data.compatibility.playerTrainerId[0] | (player->rfu.data.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5); StringCopy(gStringVar4, sText_ID); StringAppend(gStringVar4, trainerId); - PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x88), y, colorIdx); + PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x88), y, colorIdx); } } @@ -3997,7 +3997,7 @@ static void PrintGroupCandidateOnWindow(u8 windowId, u8 x, u8 y, struct RfuPlaye ConvertIntToDecimalStringN(trainerId, player->rfu.data.compatibility.playerTrainerId[0] | (player->rfu.data.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5); StringCopy(gStringVar4, sText_ID); StringAppend(gStringVar4, trainerId); - PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x68), y, colorIdx); + PrintUnionRoomText(windowId, 1, gStringVar4, GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 0x68), y, colorIdx); } } diff --git a/src/union_room_battle.c b/src/union_room_battle.c index 2a195730f..6c4dfc268 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -78,7 +78,7 @@ static void AddTextPrinterForUnionRoomBattle(u8 windowId, const u8 * str, u8 x, s32 letterSpacing = 0; s32 lineSpacing = 1; FillWindowPixelBuffer(windowId, (sTextColors[0] << 4) | sTextColors[0]); - AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, sTextColors, speed, str); + AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, lineSpacing, sTextColors, speed, str); } static bool32 PrintUnionRoomBattleMessage(s16 * state, const u8 * str, s32 speed) diff --git a/src/union_room_chat.c b/src/union_room_chat.c index a1aae08cf..abf517ef9 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -458,10 +458,10 @@ static const u8 sCaseToggleTable[256] = { [CHAR_LEFT_PAREN] = CHAR_LEFT_PAREN, [CHAR_RIGHT_PAREN] = CHAR_RIGHT_PAREN, [CHAR_AMPERSAND] = CHAR_AMPERSAND, - [CHAR_DBL_QUOT_LEFT] = CHAR_DBL_QUOT_LEFT, - [CHAR_DBL_QUOT_RIGHT] = CHAR_DBL_QUOT_RIGHT, - [CHAR_SGL_QUOT_LEFT] = CHAR_SGL_QUOT_LEFT, - [CHAR_SGL_QUOT_RIGHT] = CHAR_SGL_QUOT_RIGHT, + [CHAR_DBL_QUOTE_LEFT] = CHAR_DBL_QUOTE_LEFT, + [CHAR_DBL_QUOTE_RIGHT] = CHAR_DBL_QUOTE_RIGHT, + [CHAR_SGL_QUOTE_LEFT] = CHAR_SGL_QUOTE_LEFT, + [CHAR_SGL_QUOTE_RIGHT] = CHAR_SGL_QUOTE_RIGHT, [CHAR_MASCULINE_ORDINAL] = CHAR_MASCULINE_ORDINAL, [CHAR_FEMININE_ORDINAL] = CHAR_FEMININE_ORDINAL, [CHAR_BULLET] = CHAR_BULLET, @@ -2740,8 +2740,8 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos) { FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1)); PutWindowTilemap(sDisplay->yesNoMenuWindowId); - AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, 1, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, 1, gText_No, 8, 17, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, FONT_NORMAL, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, FONT_NORMAL, gText_No, 8, 17, TEXT_SPEED_FF, NULL); DrawTextBorderOuter(sDisplay->yesNoMenuWindowId, 1, 13); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDisplay->yesNoMenuWindowId, 2, initialCursorPos); } @@ -2811,7 +2811,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs) DrawTextBorderInner(windowId, 0xA, 2); AddTextPrinterParameterized5( windowId, - 1, + FONT_NORMAL, str, sDisplayStdMessages[msgId].x + 8, sDisplayStdMessages[msgId].y + 8, @@ -2825,7 +2825,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs) DrawTextBorderOuter(windowId, 0xA, 2); AddTextPrinterParameterized5( windowId, - 1, + FONT_NORMAL, str, sDisplayStdMessages[msgId].x, sDisplayStdMessages[msgId].y, @@ -2877,7 +2877,7 @@ static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shad strBuffer[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING; strBuffer[2] = 8; StringCopy(&strBuffer[3], str); - AddTextPrinterParameterized3(1, 2, x * 8, 1, color, TEXT_SPEED_FF, strBuffer); + AddTextPrinterParameterized3(1, FONT_SHORT, x * 8, 1, color, TEXT_SPEED_FF, strBuffer); } static void PrintCurrentKeyboardPage(void) @@ -2912,7 +2912,7 @@ static void PrintCurrentKeyboardPage(void) return; StringCopy(&str[3], sUnionRoomKeyboardText[page][i]); - AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str); + AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SPEED_FF, str); } } else @@ -2921,9 +2921,9 @@ static void PrintCurrentKeyboardPage(void) for (i = 0, top = 0; i < UNION_ROOM_KB_ROW_COUNT; i++, top += 12) { str2 = GetRegisteredTextByRow(i); - if (GetStringWidth(0, str2, 0) <= 40) + if (GetStringWidth(FONT_SMALL, str2, 0) <= 40) { - AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str2); + AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SPEED_FF, str2); } else { @@ -2932,10 +2932,10 @@ static void PrintCurrentKeyboardPage(void) { length--; StringCopyN_Multibyte(str, str2, length); - } while (GetStringWidth(0, str, 0) > 35); + } while (GetStringWidth(FONT_SMALL, str, 0) > 35); - AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str); - AddTextPrinterParameterized3(2, 0, left + 35, top, color, TEXT_SPEED_FF, sText_Ellipsis); + AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SPEED_FF, str); + AddTextPrinterParameterized3(2, FONT_SMALL, left + 35, top, color, TEXT_SPEED_FF, sText_Ellipsis); } } } @@ -2987,8 +2987,8 @@ static void ShowKeyboardSwapMenu(void) { FillWindowPixelBuffer(3, PIXEL_FILL(1)); DrawTextBorderOuter(3, 1, 13); - PrintTextArray(3, 2, 8, 1, 14, 5, sKeyboardPageTitleTexts); - sub_81983AC(3, 2, 0, 1, 14, 5, GetCurrentKeyboardPage()); + PrintTextArray(3, FONT_SHORT, 8, 1, 14, 5, sKeyboardPageTitleTexts); + sub_81983AC(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); PutWindowTilemap(3); } @@ -3006,7 +3006,7 @@ static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx) color[1] = colorIdx * 2 + 2; color[2] = colorIdx * 2 + 3; FillWindowPixelRect(0, PIXEL_FILL(1), 0, row * 15, 168, 15); - AddTextPrinterParameterized3(0, 2, 0, row * 15 + 1, color, TEXT_SPEED_FF, str); + AddTextPrinterParameterized3(0, FONT_SHORT, 0, row * 15 + 1, color, TEXT_SPEED_FF, str); } static void ResetGpuBgState(void) diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 6ebc707e5..dcfc27d91 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -876,7 +876,7 @@ static void AskUsePokeblock(void) StringCopy(gStringVar4, stringBuffer); FillWindowPixelBuffer(WIN_TEXT, 17); DrawTextBorderOuter(WIN_TEXT, 151, 14); - AddTextPrinterParameterized(WIN_TEXT, 1, gStringVar4, 0, 1, 0, NULL); + AddTextPrinterParameterized(WIN_TEXT, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL); PutWindowTilemap(WIN_TEXT); CopyWindowToVram(WIN_TEXT, 3); CreateYesNoMenu(&sUsePokeblockYesNoWinTemplate, 151, 14, 0); @@ -952,7 +952,7 @@ static void PrintWontEatAnymore(void) { FillWindowPixelBuffer(WIN_TEXT, 17); DrawTextBorderOuter(WIN_TEXT, 151, 14); - AddTextPrinterParameterized(WIN_TEXT, 1, gText_WontEatAnymore, 0, 1, 0, NULL); + AddTextPrinterParameterized(WIN_TEXT, FONT_NORMAL, gText_WontEatAnymore, 0, 1, 0, NULL); PutWindowTilemap(WIN_TEXT); CopyWindowToVram(WIN_TEXT, 3); } @@ -966,7 +966,7 @@ static void EraseMenuWindow(void) static void PrintMenuWindowText(const u8 *message) { - AddTextPrinterParameterized(WIN_TEXT, 1, gStringVar4, 0, 1, 0, NULL); + AddTextPrinterParameterized(WIN_TEXT, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL); } static void BufferEnhancedStatText(u8 *dest, u8 statId, s16 enhancement) @@ -1389,12 +1389,12 @@ static void UpdateMonInfoText(u16 loadId, bool8 firstPrint) FillWindowPixelBuffer(WIN_NATURE, PIXEL_FILL(0)); if (sMenu->info.curSelection != sMenu->info.numSelections - 1) { - AddTextPrinterParameterized(WIN_NAME, 1, sMenu->monNameStrings[loadId], 0, 1, 0, NULL); + AddTextPrinterParameterized(WIN_NAME, FONT_NORMAL, sMenu->monNameStrings[loadId], 0, 1, 0, NULL); partyIndex = GetPartyIdFromSelectionId(sMenu->info.curSelection); nature = GetNature(&gPlayerParty[partyIndex]); str = StringCopy(sMenu->info.natureText, gText_NatureSlash); str = StringCopy(str, gNatureNamePointers[nature]); - AddTextPrinterParameterized3(WIN_NATURE, 1, 2, 1, sNatureTextColors, 0, sMenu->info.natureText); + AddTextPrinterParameterized3(WIN_NATURE, FONT_NORMAL, 2, 1, sNatureTextColors, 0, sMenu->info.natureText); } if (firstPrint) diff --git a/src/wallclock.c b/src/wallclock.c index 6f9bc02ae..407c89c49 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -715,7 +715,7 @@ void CB2_StartWallClock(void) WallClockInit(); - AddTextPrinterParameterized(1, 1, gText_Confirm3, 0, 1, 0, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, gText_Confirm3, 0, 1, 0, NULL); PutWindowTilemap(1); ScheduleBgCopyTilemapToVram(2); } @@ -763,7 +763,7 @@ void CB2_ViewWallClock(void) WallClockInit(); - AddTextPrinterParameterized(1, 1, gText_Cancel4, 0, 1, 0, NULL); + AddTextPrinterParameterized(1, FONT_NORMAL, gText_Cancel4, 0, 1, 0, NULL); PutWindowTilemap(1); ScheduleBgCopyTilemapToVram(2); } @@ -828,7 +828,7 @@ static void Task_SetClock_HandleInput(u8 taskId) static void Task_SetClock_AskConfirm(u8 taskId) { DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d); - AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_NORMAL, gText_IsThisTheCorrectTime, 0, 1, 0, NULL); PutWindowTilemap(0); ScheduleBgCopyTilemapToVram(0); CreateYesNoMenu(&sWindowTemplate_ConfirmYesNo, 0x250, 0x0d, 1); diff --git a/src/wireless_communication_status_screen.c b/src/wireless_communication_status_screen.c index 5c5272a44..295eab97f 100644 --- a/src/wireless_communication_status_screen.c +++ b/src/wireless_communication_status_screen.c @@ -236,12 +236,12 @@ static void PrintHeaderTexts(void) FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(2, PIXEL_FILL(0)); - WCSS_AddTextPrinterParameterized(0, 1, sHeaderTexts[0], GetStringCenterAlignXOffset(1, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN); + WCSS_AddTextPrinterParameterized(0, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN); for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++) { - WCSS_AddTextPrinterParameterized(1, 1, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY); + WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY); } - WCSS_AddTextPrinterParameterized(1, 1, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED); + WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED); PutWindowTilemap(0); CopyWindowToVram(0, 2); PutWindowTilemap(1); @@ -280,9 +280,9 @@ static void Task_WirelessCommunicationScreen(u8 taskId) { ConvertIntToDecimalStringN(gStringVar4, sStatusScreen->groupCounts[i], STR_CONV_MODE_RIGHT_ALIGN, 2); if (i != GROUPTYPE_TOTAL) - WCSS_AddTextPrinterParameterized(2, 1, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY); + WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY); else - WCSS_AddTextPrinterParameterized(2, 1, gStringVar4, 12, 98, COLORMODE_RED); + WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 98, COLORMODE_RED); } PutWindowTilemap(2); CopyWindowToVram(2, 3); |