From a1d24603720d30d578260c34e11627acd68ac821 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Sat, 6 Apr 2024 13:00:30 +0100 Subject: [PATCH] Enable GF move names by default In contests, even FONT_NARROWER isn't sufficient to prevent clipping in all cases. e.g. Stomping Tantrum clips. We have decided to accept that cost to make the rest of the user experience better, but downstream projects that don't like that trade-off can either a) alter the contest UI, or b) set B_EXPANDED_MOVE_NAMES to FALSE. --- include/config/battle.h | 2 +- include/config/test.h | 7 ++ include/constants/global.h | 4 + src/battle_message.c | 8 ++ src/contest.c | 14 +++- src/item_menu.c | 11 ++- src/menu_specialized.c | 3 +- src/pokemon_summary_screen.c | 23 ++++-- test/battle/ability/wind_power.c | 4 +- test/battle/damage_formula.c | 2 +- test/battle/gimmick/dynamax.c | 4 +- test/battle/gimmick/terastal.c | 8 -- test/battle/item_effect/increase_stat.c | 8 +- test/battle/move_effect/corrosive_gas.c | 10 +-- test/battle/move_effect/fling.c | 2 +- test/battle/move_effect/metronome.c | 2 +- test/battle/move_effect/psychic_noise.c | 2 +- test/battle/move_effect/reflect_type.c | 2 +- test/battle/move_effect/revival_blessing.c | 18 ++--- .../move_effect/semi_invulnerable_moves.c | 8 +- test/battle/terrain/electric.c | 4 +- test/battle/terrain/misty.c | 2 +- test/battle/terrain/psychic.c | 12 +-- test/text.c | 77 +++++++++++++++++++ 24 files changed, 173 insertions(+), 64 deletions(-) create mode 100644 include/config/test.h create mode 100644 test/text.c diff --git a/include/config/battle.h b/include/config/battle.h index c47f4fedcf..f2c17f91f6 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -214,7 +214,7 @@ #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. #define B_SHOW_CATEGORY_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category. #define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. -#define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters. +#define B_EXPANDED_MOVE_NAMES TRUE // If set to FALSE, move names are decreased from 16 characters to 12 characters. #define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles. #define B_QUICK_MOVE_CURSOR_TO_RUN FALSE // If set to TRUE, pushing B in the battle options against a wild encounter will move the cursor to the run option diff --git a/include/config/test.h b/include/config/test.h new file mode 100644 index 0000000000..9d8066864a --- /dev/null +++ b/include/config/test.h @@ -0,0 +1,7 @@ +#ifndef GUARD_CONFIG_TEST_H +#define GUARD_CONFIG_TEST_H + +#undef B_EXPANDED_MOVE_NAMES +#define B_EXPANDED_MOVE_NAMES TRUE + +#endif // GUARD_CONFIG_TEST_H diff --git a/include/constants/global.h b/include/constants/global.h index b8ac7559a8..daf1c9edb4 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -170,4 +170,8 @@ #define CONNECTION_DIVE 5 #define CONNECTION_EMERGE 6 +#if TESTING +#include "config/test.h" +#endif + #endif // GUARD_CONSTANTS_GLOBAL_H diff --git a/src/battle_message.c b/src/battle_message.c index 5f7e6ca052..b713d846ad 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3949,6 +3949,14 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) printerTemplate.bgColor = textInfo[windowId].bgColor; printerTemplate.shadowColor = textInfo[windowId].shadowColor; + if (B_WIN_MOVE_NAME_1 <= windowId && windowId <= B_WIN_MOVE_NAME_4) + { + // We cannot check the actual width of the window because + // B_WIN_MOVE_NAME_1 and B_WIN_MOVE_NAME_3 are 16 wide for + // Z-move details. + printerTemplate.fontId = GetFontIdToFit(text, printerTemplate.fontId, printerTemplate.letterSpacing, 8 * TILE_WIDTH); + } + if (printerTemplate.x == 0xFF) { u32 width = GetBattleWindowTemplatePixelWidth(gBattleScripting.windowsType, windowId); diff --git a/src/contest.c b/src/contest.c index f0d0d527ed..c500fda60d 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1085,6 +1085,12 @@ static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGO } }; +static void CopyMoveNameToFit(u8 *dest, u32 move) +{ + u8 *end = StringCopy(dest, GetMoveName(move)); + WrapFontIdToFit(dest, end, FONT_NORMAL, 84); +} + static void TaskDummy1(u8 taskId) { } @@ -1636,7 +1642,7 @@ static void Task_ShowMoveSelectScreen(u8 taskId) moveNameBuffer = StringCopy(moveNameBuffer, GetMoveName(move)); FillWindowPixelBuffer(i + MOVE_WINDOWS_START, PIXEL_FILL(0)); - Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, FONT_NARROW); + Contest_PrintTextToBg0WindowAt(i + MOVE_WINDOWS_START, moveName, 5, 1, GetFontIdToFit(moveName, FONT_NARROW, 0, WindowWidthPx(i + MOVE_WINDOWS_START) - 11)); } DrawMoveSelectArrow(eContest.playerMoveChoice); @@ -2295,7 +2301,7 @@ static void Task_DoAppeals(u8 taskId) if (eContestantStatus[contestant].overrideCategoryExcitementMod) { r3 = 1; - StringCopy(gStringVar3, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar3, eContestantStatus[contestant].currMove); } else { @@ -2430,7 +2436,7 @@ static void Task_DoAppeals(u8 taskId) ContestClearGeneralTextWindow(); StringCopy(gStringVar3, gContestMons[eContestExcitement.freezer].nickname); StringCopy(gStringVar1, gContestMons[contestant].nickname); - StringCopy(gStringVar2, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_CrowdContinuesToWatchMon); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tState = APPEALSTATE_PRINT_MON_MOVE_IGNORED_MSG; @@ -2456,7 +2462,7 @@ static void Task_DoAppeals(u8 taskId) eContestantStatus[contestant].hasJudgesAttention = FALSE; StartStopFlashJudgeAttentionEye(contestant); StringCopy(gStringVar1, gContestMons[contestant].nickname); - StringCopy(gStringVar2, GetMoveName(eContestantStatus[contestant].currMove)); + CopyMoveNameToFit(gStringVar2, eContestantStatus[contestant].currMove); StringExpandPlaceholders(gStringVar4, gText_MonWasTooNervousToMove); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].tState = APPEALSTATE_WAIT_TOO_NERVOUS_MSG; diff --git a/src/item_menu.c b/src/item_menu.c index 569712cfe6..dde142d021 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -109,7 +109,7 @@ struct ListBuffer1 { }; struct ListBuffer2 { - u8 name[MAX_POCKET_ITEMS][ITEM_NAME_LENGTH + 10]; + u8 name[MAX_POCKET_ITEMS][max(ITEM_NAME_LENGTH, MOVE_NAME_LENGTH + 3) + 10]; }; struct TempWallyBag { @@ -905,10 +905,19 @@ static void LoadBagItemListBuffers(u8 pocketId) static void GetItemName(u8 *dest, u16 itemId) { + u32 fontId; switch (gBagPosition.pocket) { case TMHM_POCKET: StringCopy(gStringVar2, GetMoveName(ItemIdToBattleMoveId(itemId))); + fontId = GetFontIdToFit(gStringVar2, FONT_NARROW, 0, 73); + if (fontId != FONT_NARROW) + { + gStringVar2[0] = EXT_CTRL_CODE_BEGIN; + gStringVar2[1] = EXT_CTRL_CODE_FONT; + gStringVar2[2] = fontId; + StringCopy(&gStringVar2[3], GetMoveName(ItemIdToBattleMoveId(itemId))); + } if (itemId >= ITEM_HM01) { // Get HM number diff --git a/src/menu_specialized.c b/src/menu_specialized.c index fcb65d9ae7..a80a227a4b 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -186,7 +186,8 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate = .itemVerticalPadding = 0, .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, .fontId = FONT_NORMAL, - .cursorKind = CURSOR_BLACK_ARROW + .cursorKind = CURSOR_BLACK_ARROW, + .textNarrowWidth = 68, }; //-------------- diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 6e63ce5eab..ee2d0e9853 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2800,12 +2800,23 @@ static void ResetWindows(void) sMonSummaryScreen->windowIds[i] = WINDOW_NONE; } -static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +static void PrintTextOnWindowWithFont(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId, u32 fontId) { if (DECAP_ENABLED && DECAP_MIRRORING && !DECAP_SUMMARY) - AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string)); + AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, MirrorPtr(string)); else - AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); + AddTextPrinterParameterized4(windowId, fontId, x, y, 0, lineSpacing, sTextColors[colorId], 0, string); +} + +static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +{ + PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, FONT_NORMAL); +} + +static void PrintTextOnWindowToFit(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) +{ + u32 fontId = GetFontIdToFit(string, FONT_NORMAL, 0, WindowWidthPx(windowId)); + PrintTextOnWindowWithFont(windowId, string, x, y, lineSpacing, colorId, fontId); } static void PrintMonInfo(void) @@ -3626,7 +3637,7 @@ static void PrintMoveNameAndPP(u8 moveIndex) if (move != 0) { pp = CalculatePPWithBonus(move, summary->ppBonuses, moveIndex); - PrintTextOnWindow(moveNameWindowId, GetMoveName(move), 0, moveIndex * 16 + 1, 0, 1); + PrintTextOnWindowToFit(moveNameWindowId, GetMoveName(move), 0, moveIndex * 16 + 1, 0, 1); ConvertIntToDecimalStringN(gStringVar1, summary->pp[moveIndex], STR_CONV_MODE_RIGHT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar2, pp, STR_CONV_MODE_RIGHT_ALIGN, 2); DynamicPlaceholderTextUtil_Reset(); @@ -3794,9 +3805,9 @@ static void PrintNewMoveDetailsOrCancelText(void) u16 move = sMonSummaryScreen->newMove; if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) - PrintTextOnWindow(windowId1, GetMoveName(move), 0, 65, 0, 6); + PrintTextOnWindowToFit(windowId1, GetMoveName(move), 0, 65, 0, 6); else - PrintTextOnWindow(windowId1, GetMoveName(move), 0, 65, 0, 5); + PrintTextOnWindowToFit(windowId1, GetMoveName(move), 0, 65, 0, 5); ConvertIntToDecimalStringN(gStringVar1, gMovesInfo[move].pp, STR_CONV_MODE_RIGHT_ALIGN, 2); DynamicPlaceholderTextUtil_Reset(); diff --git a/test/battle/ability/wind_power.c b/test/battle/ability/wind_power.c index bbf76cd6fb..146c47f3dd 100644 --- a/test/battle/ability/wind_power.c +++ b/test/battle/ability/wind_power.c @@ -167,12 +167,12 @@ DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ab HP_BAR(playerLeft); if (abilityLeft == ABILITY_WIND_POWER) { ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER); - MESSAGE("Being hit by PetalBlizzrd charged Wattrel with power!"); + MESSAGE("Being hit by Petal Blizzard charged Wattrel with power!"); } HP_BAR(playerRight); if (abilityRight == ABILITY_WIND_POWER) { ABILITY_POPUP(playerRight, ABILITY_WIND_POWER); - MESSAGE("Being hit by PetalBlizzrd charged Wattrel with power!"); + MESSAGE("Being hit by Petal Blizzard charged Wattrel with power!"); } HP_BAR(opponentRight); NOT HP_BAR(opponentLeft); diff --git a/test/battle/damage_formula.c b/test/battle/damage_formula.c index 2fdb9bed0f..d89fb7e7fd 100644 --- a/test/battle/damage_formula.c +++ b/test/battle/damage_formula.c @@ -109,7 +109,7 @@ SINGLE_BATTLE_TEST("Damage calculation matches Gen5+ (Marshadow vs Mawile)") } } SCENE{ - MESSAGE("Marshadow used SpectrlThief!"); + MESSAGE("Marshadow used Spectral Thief!"); HP_BAR(opponent, captureDamage: &dmg); } THEN{ diff --git a/test/battle/gimmick/dynamax.c b/test/battle/gimmick/dynamax.c index 2db55d87b6..42e48c9e9c 100644 --- a/test/battle/gimmick/dynamax.c +++ b/test/battle/gimmick/dynamax.c @@ -834,9 +834,9 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Mindstorm sets up Psychic Terrain") TURN { MOVE(opponent, MOVE_EXTREME_SPEED); MOVE(player, MOVE_PSYCHIC, dynamax: TRUE); } TURN { MOVE(opponent, MOVE_EXTREME_SPEED); MOVE(player, MOVE_PSYCHIC); } } SCENE { - MESSAGE("Foe Wobbuffet used ExtremeSpeed!"); + MESSAGE("Foe Wobbuffet used Extreme Speed!"); MESSAGE("Wobbuffet used Max Mindstorm!"); - MESSAGE("Foe Wobbuffet cannot use ExtremeSpeed!"); + MESSAGE("Foe Wobbuffet cannot use Extreme Speed!"); MESSAGE("Wobbuffet used Max Mindstorm!"); } } diff --git a/test/battle/gimmick/terastal.c b/test/battle/gimmick/terastal.c index 3166e2d67c..18eab992af 100644 --- a/test/battle/gimmick/terastal.c +++ b/test/battle/gimmick/terastal.c @@ -422,11 +422,7 @@ SINGLE_BATTLE_TEST("(TERA) Revelation Dance uses a Terastallized Pokemon's Tera } WHEN { TURN { MOVE(player, MOVE_REVELATION_DANCE, tera: TRUE); } } SCENE { - #if B_EXPANDED_MOVE_NAMES == TRUE MESSAGE("Oricorio used Revelation Dance!"); - #else - MESSAGE("Oricorio used RvlationDnce!"); - #endif MESSAGE("It doesn't affect Foe Gengar…"); NOT { HP_BAR(opponent); } } @@ -547,11 +543,7 @@ SINGLE_BATTLE_TEST("(TERA) Revelation Dance uses a Stellar-type Pokemon's base t } WHEN { TURN { MOVE(player, MOVE_REVELATION_DANCE, tera: TRUE); } } SCENE { - #if B_EXPANDED_MOVE_NAMES == TRUE MESSAGE("Oricorio used Revelation Dance!"); - #else - MESSAGE("Oricorio used RvlationDnce!"); - #endif MESSAGE("It doesn't affect Foe Gumshoos…"); NOT { HP_BAR(opponent); } } diff --git a/test/battle/item_effect/increase_stat.c b/test/battle/item_effect/increase_stat.c index df36b8ff33..4eba548961 100644 --- a/test/battle/item_effect/increase_stat.c +++ b/test/battle/item_effect/increase_stat.c @@ -63,7 +63,7 @@ SINGLE_BATTLE_TEST("X Sp. Atk sharply raises battler's Sp. Attack stat", s16 dam if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_ATK); } TURN { MOVE(player, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Wobbuffet used DisrmngVoice!"); + MESSAGE("Wobbuffet used Disarming Voice!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { if (B_X_ITEMS_BUFF >= GEN_7) @@ -87,7 +87,7 @@ SINGLE_BATTLE_TEST("X Sp. Def sharply raises battler's Sp. Defense stat", s16 da if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_DEF); } TURN { MOVE(opponent, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Foe Wobbuffet used DisrmngVoice!"); + MESSAGE("Foe Wobbuffet used Disarming Voice!"); HP_BAR(player, captureDamage: &results[i].damage); } FINALLY { if (B_X_ITEMS_BUFF >= GEN_7) @@ -205,7 +205,7 @@ SINGLE_BATTLE_TEST("Max Mushrooms raises battler's Sp. Attack stat", s16 damage) if (useItem) TURN { USE_ITEM(player, ITEM_MAX_MUSHROOMS); } TURN { MOVE(player, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Wobbuffet used DisrmngVoice!"); + MESSAGE("Wobbuffet used Disarming Voice!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); @@ -225,7 +225,7 @@ SINGLE_BATTLE_TEST("Max Mushrooms battler's Sp. Defense stat", s16 damage) if (useItem) TURN { USE_ITEM(player, ITEM_MAX_MUSHROOMS); } TURN { MOVE(opponent, MOVE_DISARMING_VOICE); } } SCENE { - MESSAGE("Foe Wobbuffet used DisrmngVoice!"); + MESSAGE("Foe Wobbuffet used Disarming Voice!"); HP_BAR(player, captureDamage: &results[i].damage); } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.66), results[1].damage); diff --git a/test/battle/move_effect/corrosive_gas.c b/test/battle/move_effect/corrosive_gas.c index c2c921cf74..714702703a 100644 --- a/test/battle/move_effect/corrosive_gas.c +++ b/test/battle/move_effect/corrosive_gas.c @@ -19,7 +19,7 @@ SINGLE_BATTLE_TEST("Corrosive Gas destroys the target's item or fails if the tar } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); if (item == ITEM_POTION) { ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); @@ -40,11 +40,11 @@ SINGLE_BATTLE_TEST("Corrosive Gas doesn't destroy the item of a Pokemon with the } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); NOT MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); ABILITY_POPUP(opponent, ABILITY_STICKY_HOLD); - MESSAGE("Foe Muk's Sticky Hold made CorrosiveGas ineffective!"); + MESSAGE("Foe Muk's Sticky Hold made Corrosive Gas ineffective!"); } THEN { EXPECT_EQ(opponent->item, ITEM_POISON_BARB); } @@ -59,7 +59,7 @@ SINGLE_BATTLE_TEST("Items lost to Corrosive Gas cannot be restored by Recycle") } WHEN { TURN { MOVE(player, MOVE_CORROSIVE_GAS); MOVE(opponent, MOVE_RECYCLE); } } SCENE { - MESSAGE("Wobbuffet used CorrosiveGas!"); + MESSAGE("Wobbuffet used Corrosive Gas!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); MESSAGE("Wobbuffet corroded Foe Wobbuffet's Oran Berry!"); MESSAGE("Foe Wobbuffet used Recycle!"); @@ -93,7 +93,7 @@ DOUBLE_BATTLE_TEST("Corrosive Gas destroys foes and ally's items if they have on } WHEN { TURN { MOVE(playerRight, MOVE_CORROSIVE_GAS); } } SCENE { - MESSAGE("Wynaut used CorrosiveGas!"); + MESSAGE("Wynaut used Corrosive Gas!"); if (itemPlayerLeft == ITEM_CHERI_BERRY) { MESSAGE("Wynaut corroded Wobbuffet's Cheri Berry!"); } else { diff --git a/test/battle/move_effect/fling.c b/test/battle/move_effect/fling.c index f6b83215a1..b4b25484b3 100644 --- a/test/battle/move_effect/fling.c +++ b/test/battle/move_effect/fling.c @@ -114,7 +114,7 @@ SINGLE_BATTLE_TEST("Fling - Item is lost even when there is no target") TURN { MOVE(opponent, MOVE_SELF_DESTRUCT); MOVE(player, MOVE_FLING); SEND_OUT(opponent, 1); } TURN { MOVE(player, MOVE_FLING); } } SCENE { - MESSAGE("Foe Wobbuffet used SelfDestruct!"); + MESSAGE("Foe Wobbuffet used Self-Destruct!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_SELF_DESTRUCT, opponent); HP_BAR(player); MESSAGE("Foe Wobbuffet fainted!"); diff --git a/test/battle/move_effect/metronome.c b/test/battle/move_effect/metronome.c index d4efcaafff..22e3390cb2 100644 --- a/test/battle/move_effect/metronome.c +++ b/test/battle/move_effect/metronome.c @@ -35,7 +35,7 @@ SINGLE_BATTLE_TEST("Metronome's called powder move fails against Grass Types") } SCENE { MESSAGE("Wobbuffet used Metronome!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_METRONOME, player); - MESSAGE("Wobbuffet used PoisonPowder!"); + MESSAGE("Wobbuffet used Poison Powder!"); NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_POWDER, player); MESSAGE("It doesn't affect Foe Tangela…"); NOT STATUS_ICON(opponent, poison: TRUE); diff --git a/test/battle/move_effect/psychic_noise.c b/test/battle/move_effect/psychic_noise.c index 7846157b77..e8d50dc961 100644 --- a/test/battle/move_effect/psychic_noise.c +++ b/test/battle/move_effect/psychic_noise.c @@ -35,7 +35,7 @@ SINGLE_BATTLE_TEST("Psychic Noise is blocked by Soundproof") TURN { MOVE(player, MOVE_PSYCHIC_NOISE); MOVE(opponent, MOVE_RECOVER); } } SCENE { ABILITY_POPUP(opponent, ABILITY_SOUNDPROOF); - MESSAGE("Foe Voltorb's Soundproof blocks PsychicNoise!"); + MESSAGE("Foe Voltorb's Soundproof blocks Psychic Noise!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); } } diff --git a/test/battle/move_effect/reflect_type.c b/test/battle/move_effect/reflect_type.c index e873516034..b75ffc0b0d 100644 --- a/test/battle/move_effect/reflect_type.c +++ b/test/battle/move_effect/reflect_type.c @@ -171,7 +171,7 @@ SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 an HP_BAR(player); MESSAGE("Foe Arcanine burned itself out!"); // Turn 2 - MESSAGE("Wobbuffet used Forest'sCurs!"); + MESSAGE("Wobbuffet used Forest's Curse!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_FORESTS_CURSE, player); MESSAGE("Grass type was added to Foe Arcanine!"); // Turn 3 diff --git a/test/battle/move_effect/revival_blessing.c b/test/battle/move_effect/revival_blessing.c index 397e01e73a..d44e9110d5 100644 --- a/test/battle/move_effect/revival_blessing.c +++ b/test/battle/move_effect/revival_blessing.c @@ -5,12 +5,6 @@ // behaviors. These have been tested in-game, in double, in multi, and in link battles. AI will always // revive their first fainted party member in order. -#if B_EXPANDED_MOVE_NAMES -#define REVIVAL_BLESSING "Revival Blessing" -#else -#define REVIVAL_BLESSING "RevivlBlesng" -#endif - ASSUMPTIONS { ASSUME(gMovesInfo[MOVE_REVIVAL_BLESSING].effect == EFFECT_REVIVAL_BLESSING); @@ -26,7 +20,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a chosen fainted party member for t } WHEN { TURN { MOVE(player, MOVE_REVIVAL_BLESSING); SEND_OUT(player, 2); } } SCENE { - MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!"); + MESSAGE("Wobbuffet used Revival Blessing!"); MESSAGE("Wynaut was revived and is ready to fight again!"); } } @@ -41,7 +35,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a fainted party member for an oppon } WHEN { TURN { MOVE(opponent, MOVE_REVIVAL_BLESSING); SEND_OUT(opponent, 1); } } SCENE { - MESSAGE("Foe Raichu used " REVIVAL_BLESSING "!"); + MESSAGE("Foe Raichu used Revival Blessing!"); MESSAGE("Pichu was revived and is ready to fight again!"); } } @@ -54,7 +48,7 @@ SINGLE_BATTLE_TEST("Revival Blessing fails if no party members are fainted") } WHEN { TURN { MOVE(player, MOVE_REVIVAL_BLESSING); } } SCENE { - MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!"); + MESSAGE("Wobbuffet used Revival Blessing!"); MESSAGE("But it failed!"); } } @@ -82,10 +76,10 @@ TO_DO_BATTLE_TEST("Revival Blessing cannot revive a partner's party member"); // TURN { MOVE(user, MOVE_REVIVAL_BLESSING); } // } SCENE { // if (user == opponentLeft) { -// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wobbuffet used Revival Blessing!"); // MESSAGE("But it failed!"); // } else { -// MESSAGE("Foe Wynaut used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wynaut used Revival Blessing!"); // MESSAGE("Wynaut was revived and is ready to fight again!"); // } // } @@ -108,7 +102,7 @@ TO_DO_BATTLE_TEST("Revived battlers still lose their turn"); // } SCENE { // MESSAGE("Wobbuffet used Tackle!"); // MESSAGE("Foe Wynaut fainted!"); -// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!"); +// MESSAGE("Foe Wobbuffet used Revival Blessing!"); // MESSAGE("Wynaut was revived and is ready to fight again!"); // NOT { MESSAGE("Wynaut used Celebrate!"); } // } diff --git a/test/battle/move_effect/semi_invulnerable_moves.c b/test/battle/move_effect/semi_invulnerable_moves.c index 97760225d1..3ba4889005 100644 --- a/test/battle/move_effect/semi_invulnerable_moves.c +++ b/test/battle/move_effect/semi_invulnerable_moves.c @@ -58,7 +58,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves make the user semi-invulnerable turn break; case MOVE_PHANTOM_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); @@ -112,7 +112,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves make the user semi-invulnerable turn MESSAGE("Wobbuffet used Dive!"); break; case MOVE_PHANTOM_FORCE: - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: MESSAGE("Wobbuffet used Shadow Force!"); @@ -163,7 +163,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves don't need to charge with Power Herb break; case MOVE_PHANTOM_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: NOT MESSAGE("Wobbuffet vanished instantly!"); @@ -215,7 +215,7 @@ SINGLE_BATTLE_TEST("Semi-invulnerable moves don't need to charge with Power Herb MESSAGE("Wobbuffet used Dive!"); break; case MOVE_PHANTOM_FORCE: - MESSAGE("Wobbuffet used PhantomForce!"); + MESSAGE("Wobbuffet used Phantom Force!"); break; case MOVE_SHADOW_FORCE: MESSAGE("Wobbuffet used Shadow Force!"); diff --git a/test/battle/terrain/electric.c b/test/battle/terrain/electric.c index c6fda3fb3e..eb7a112bb5 100644 --- a/test/battle/terrain/electric.c +++ b/test/battle/terrain/electric.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Electric Terrain protects grounded battlers from falling asl TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); MOVE(opponent, MOVE_SPORE); } TURN { MOVE(player, MOVE_SPORE); } } SCENE { - MESSAGE("Wobbuffet used ElctrcTrrain!"); + MESSAGE("Wobbuffet used Electric Terrain!"); MESSAGE("Foe Claydol used Spore!"); MESSAGE("Wobbuffet surrounds itself with electrified terrain!"); MESSAGE("Wobbuffet used Spore!"); @@ -51,7 +51,7 @@ SINGLE_BATTLE_TEST("Electric Terrain increases power of Electric-type moves by 3 TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } TURN { MOVE(player, MOVE_THUNDER_SHOCK); } } SCENE { - MESSAGE("Wobbuffet used ThunderShock!"); + MESSAGE("Wobbuffet used Thunder Shock!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { if (B_TERRAIN_TYPE_BOOST >= GEN_8) diff --git a/test/battle/terrain/misty.c b/test/battle/terrain/misty.c index c76689ce79..cd89b2d9ab 100644 --- a/test/battle/terrain/misty.c +++ b/test/battle/terrain/misty.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Misty Terrain protects grounded battlers from non-volatile s TURN { MOVE(player, MOVE_MISTY_TERRAIN); MOVE(opponent, MOVE_TOXIC); } TURN { MOVE(player, MOVE_TOXIC); } } SCENE { - MESSAGE("Wobbuffet used MistyTerrain!"); + MESSAGE("Wobbuffet used Misty Terrain!"); MESSAGE("Foe Claydol used Toxic!"); MESSAGE("Wobbuffet surrounds itself with a protective mist!"); NOT { STATUS_ICON(opponent, badPoison: TRUE); } diff --git a/test/battle/terrain/psychic.c b/test/battle/terrain/psychic.c index 20f7deef6e..1881db6297 100644 --- a/test/battle/terrain/psychic.c +++ b/test/battle/terrain/psychic.c @@ -10,7 +10,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain protects grounded battlers from priority mov TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_QUICK_ATTACK); MOVE(opponent, MOVE_QUICK_ATTACK); } } SCENE { - MESSAGE("Claydol used PsychcTrrain!"); + MESSAGE("Claydol used Psychic Terrain!"); MESSAGE("Claydol cannot use Quick Attack!"); NOT { HP_BAR(opponent); } MESSAGE("Foe Wobbuffet used Quick Attack!"); @@ -69,7 +69,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_RECOVER); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Recover!"); HP_BAR(player); } @@ -84,7 +84,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_HAZE); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Haze!"); } } @@ -98,7 +98,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_SPIKES); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Spikes!"); } } @@ -114,7 +114,7 @@ DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all TURN { MOVE(playerLeft, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(playerLeft, MOVE_HEAL_PULSE, target: playerRight); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Heal Pulse!"); } } @@ -128,7 +128,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves") TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } TURN { MOVE(player, MOVE_SUNNY_DAY); } } SCENE { - MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Psychic Terrain!"); MESSAGE("Sableye used Sunny Day!"); } } diff --git a/test/text.c b/test/text.c new file mode 100644 index 0000000000..ee81386c00 --- /dev/null +++ b/test/text.c @@ -0,0 +1,77 @@ +#include "global.h" +#include "test/test.h" +#include "item.h" +#include "text.h" +#include "constants/moves.h" + +TEST("Move names fit on Pokemon Summary Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 72; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Battle Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 64; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Contest Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 61; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + // All moves explicitly listed here are too big to fit. + switch (move) + { + case MOVE_NATURES_MADNESS: + EXPECT_GT(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); + break; + default: + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); + break; + } +} + +TEST("Move names fit on TMs & HMs Bag Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 63; + u32 move = MOVE_NONE; + for (i = 1; i < ITEMS_COUNT; i++) + { + if (gItemsInfo[i].pocket == POCKET_TM_HM) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[gItemsInfo[i].secondaryId].name) { move = gItemsInfo[i].secondaryId; } + } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +} + +TEST("Move names fit on Move Relearner Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 72; + u32 move = MOVE_NONE; + for (i = 1; i < MOVES_COUNT; i++) + { + PARAMETRIZE_LABEL("%S", gMovesInfo[i].name) { move = i; } + } + EXPECT_LE(GetStringWidth(fontId, gMovesInfo[move].name, 0), widthPx); +}