Skip to content

Commit

Permalink
Enable GF type names by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgriffin committed Apr 25, 2024
1 parent 073f12b commit 664fe90
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions include/config/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 3 additions & 5 deletions src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
}

Expand Down
17 changes: 10 additions & 7 deletions src/pokedex.c
Original file line number Diff line number Diff line change
Expand Up @@ -5008,13 +5008,16 @@ static u8 LoadSearchMenu(void)
return CreateTask(Task_LoadSearchMenu, 0);
}

static void PrintSearchText(const u8 *str, u32 x, u32 y)
static void PrintSearchTextToFit(const u8 *str, u32 x, u32 y, u32 width)
{
u8 color[3];
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);
}

color[0] = TEXT_COLOR_TRANSPARENT;
color[1] = TEXT_DYNAMIC_COLOR_6;
color[2] = TEXT_COLOR_DARK_GRAY;
static void PrintSearchText(const u8 *str, u32 x, u32 y)
{
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);
}

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/battle/terrain/electric.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/battle/terrain/psychic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
25 changes: 25 additions & 0 deletions test/text.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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);
}

0 comments on commit 664fe90

Please sign in to comment.