diff --git a/include/config/battle.h b/include/config/battle.h index 16f8586614..b6c55e8d24 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -39,7 +39,7 @@ #define B_MULTIPLE_TARGETS_DMG GEN_LATEST // In Gen4+, damage dealt by moves that hit multiple targets at once is reduced to 75%. Before, it was 50%. // Type settings -#define B_EXPANDED_TYPE_NAMES FALSE // If TRUE, type names are increased from 6 characters to 8 characters. +#define B_EXPANDED_TYPE_NAMES TRUE // If TRUE, type names are increased from 6 characters to 8 characters. #define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. #define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. #define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. diff --git a/include/config/test.h b/include/config/test.h index cba8012d36..4101f7a559 100644 --- a/include/config/test.h +++ b/include/config/test.h @@ -7,5 +7,7 @@ #define I_EXPANDED_ITEM_NAMES TRUE #undef POKEMON_NAME_LENGTH #define POKEMON_NAME_LENGTH 12 +#undef B_EXPANDED_TYPE_NAMES +#define B_EXPANDED_TYPE_NAMES TRUE #endif // GUARD_CONFIG_TEST_H diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 10a91a1485..b86da34d24 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1745,16 +1745,13 @@ static void MoveSelectionDisplayPpNumber(u32 battler) static void MoveSelectionDisplayMoveType(u32 battler) { - u8 *txtPtr; + u8 *txtPtr, *end; u8 type; u32 speciesId; struct Pokemon *mon; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); - *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; - *(txtPtr)++ = EXT_CTRL_CODE_FONT; - *(txtPtr)++ = FONT_NORMAL; if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_IVY_CUDGEL) { @@ -1771,7 +1768,8 @@ static void MoveSelectionDisplayMoveType(u32 battler) else type = gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].type; - StringCopy(txtPtr, gTypesInfo[type].name); + end = StringCopy(txtPtr, gTypesInfo[type].name); + PrependFontIdToFit(txtPtr, end, FONT_NORMAL, WindowWidthPx(B_WIN_MOVE_TYPE) - 25); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/pokedex.c b/src/pokedex.c index 75f8d70720..7c39b2502c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5008,13 +5008,16 @@ static u8 LoadSearchMenu(void) return CreateTask(Task_LoadSearchMenu, 0); } +static void PrintSearchTextToFit(const u8 *str, u32 x, u32 y, u32 width) +{ + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_DARK_GRAY }; + u32 fontId = GetFontIdToFit(str, FONT_NORMAL, 0, width); + AddTextPrinterParameterized4(0, fontId, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); +} + static void PrintSearchText(const u8 *str, u32 x, u32 y) { - u8 color[3]; - - color[0] = TEXT_COLOR_TRANSPARENT; - color[1] = TEXT_DYNAMIC_COLOR_6; - color[2] = TEXT_COLOR_DARK_GRAY; + static const u8 color[3] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_DARK_GRAY }; AddTextPrinterParameterized4(0, FONT_NORMAL, x, y, 0, 0, color, TEXT_SKIP_DRAW, str); } @@ -5634,10 +5637,10 @@ static void PrintSelectedSearchParameters(u8 taskId) PrintSearchText(sDexSearchColorOptions[searchParamId].title, 0x2D, 0x21); searchParamId = gTasks[taskId].tCursorPos_TypeLeft + gTasks[taskId].tScrollOffset_TypeLeft; - PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x2D, 0x31); + PrintSearchTextToFit(sDexSearchTypeOptions[searchParamId].title, 0x2D, 0x31, 38); searchParamId = gTasks[taskId].tCursorPos_TypeRight + gTasks[taskId].tScrollOffset_TypeRight; - PrintSearchText(sDexSearchTypeOptions[searchParamId].title, 0x5D, 0x31); + PrintSearchTextToFit(sDexSearchTypeOptions[searchParamId].title, 0x5D, 0x31, 38); searchParamId = gTasks[taskId].tCursorPos_Order + gTasks[taskId].tScrollOffset_Order; PrintSearchText(sDexOrderOptions[searchParamId].title, 0x2D, 0x41); diff --git a/test/battle/terrain/electric.c b/test/battle/terrain/electric.c index eb7a112bb5..2227afdcd9 100644 --- a/test/battle/terrain/electric.c +++ b/test/battle/terrain/electric.c @@ -32,7 +32,7 @@ SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry") ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); MESSAGE("Using Electric Seed, the Defense of Wobbuffet rose!"); ABILITY_POPUP(opponent); - MESSAGE("Foe Stunfisk's type changed to Electr!"); + MESSAGE("Foe Stunfisk's type changed to Electric!"); } THEN { EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC); } diff --git a/test/battle/terrain/psychic.c b/test/battle/terrain/psychic.c index 1881db6297..0c13122fa6 100644 --- a/test/battle/terrain/psychic.c +++ b/test/battle/terrain/psychic.c @@ -31,7 +31,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain activates Psychic Seed and Mimicry") ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); MESSAGE("Using Psychic Seed, the Sp. Def of Wobbuffet rose!"); ABILITY_POPUP(opponent); - MESSAGE("Foe Stunfisk's type changed to Psychc!"); + MESSAGE("Foe Stunfisk's type changed to Psychic!"); } THEN { EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_PSYCHIC); } diff --git a/test/text.c b/test/text.c index 9766433a8e..e8eb4f7f24 100644 --- a/test/text.c +++ b/test/text.c @@ -1,5 +1,6 @@ #include "global.h" #include "test/test.h" +#include "battle_main.h" #include "item.h" #include "text.h" #include "constants/abilities.h" @@ -523,3 +524,27 @@ TEST("Ability names fit on Ability Pop-Up") } EXPECT_LE(GetStringWidth(fontId, gAbilitiesInfo[ability].name, 0), widthPx); } + +TEST("Type names fit on Battle Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 39; + u32 type = TYPE_NORMAL; + for (i = 0; i < NUMBER_OF_MON_TYPES; i++) + { + PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } + } + EXPECT_LE(GetStringWidth(fontId, gTypesInfo[type].name, 0), widthPx); +} + +TEST("Type names fit on Pokedex Search Screen") +{ + u32 i; + const u32 fontId = FONT_NARROWER, widthPx = 38; + u32 type = TYPE_NORMAL; + for (i = 0; i < NUMBER_OF_MON_TYPES; i++) + { + PARAMETRIZE_LABEL("%S", gTypesInfo[i].name) { type = i; } + } + EXPECT_LE(GetStringWidth(fontId, gTypesInfo[type].name, 0), widthPx); +}