Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condense duplicate strings #5771

Draft
wants to merge 8 commits into
base: upcoming
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/battle_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ extern const u8 gText_Mind[];
extern const u8 gText_Skill[];
extern const u8 gText_Body[];
extern const u8 gText_Judgment[];
extern const u8 gText_EmptyString3[];
extern const u8 gText_RecordBattleToPass[];
extern const u8 gText_BattleRecordedOnPass[];
extern const u8 gText_BattleTourney[];
Expand Down
8 changes: 1 addition & 7 deletions include/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extern const u8 gText_ABtnTitleScreen[];
extern const u8 gText_ABtnRegistrationCounter[];
extern const u8 gText_MixingRecords[];
extern const u8 gText_RecordMixingComplete[];
extern const u8 gText_EmptyString2[];
extern const u8 gText_EmptyString[];
extern const u8 gText_Confirm3[];
extern const u8 gText_Cancel4[];
extern const u8 gText_IsThisTheCorrectTime[];
Expand Down Expand Up @@ -727,7 +727,6 @@ extern const u8 gText_XNatureMetSomewhereAt[];
extern const u8 gText_XNatureFatefulEncounter[];
extern const u8 gText_XNatureProbablyMetAt[];
extern const u8 gText_XNatureObtainedInTrade[];
extern const u8 gText_EmptyString5[];
extern const u8 gText_EggWillTakeALongTime[];
extern const u8 gText_EggAboutToHatch[];
extern const u8 gText_EggWillHatchSoon[];
Expand Down Expand Up @@ -844,7 +843,6 @@ extern const u8 gText_DexSortHeaviestDescription[];
extern const u8 gText_DexSortLightestDescription[];
extern const u8 gText_DexSortTallestDescription[];
extern const u8 gText_DexSortSmallestDescription[];
extern const u8 gText_DexEmptyString[];
extern const u8 gText_DexSearchDontSpecify[];
extern const u8 gText_DexSearchTypeNone[];

Expand All @@ -863,7 +861,6 @@ extern const u8 gText_TradeCenter[];
extern const u8 gText_Colosseum[];
extern const u8 gText_RecordCorner[];
extern const u8 gText_BerryCrush3[];
extern const u8 gText_Blank[];
extern const u8 gText_BattleRules[];
extern const u8 gText_JudgeMind[];
extern const u8 gText_JudgeSkill[];
Expand Down Expand Up @@ -1568,7 +1565,6 @@ extern const u8 gText_Time[];
// daycare
extern const u8 gText_MaleSymbol4[];
extern const u8 gText_FemaleSymbol4[];
extern const u8 gText_GenderlessSymbol[];
extern const u8 gText_NewLine2[];
extern const u8 gText_Exit4[];
extern const u8 gText_Lv[];
Expand Down Expand Up @@ -1965,7 +1961,6 @@ extern const u8 gText_TrainerCardName[];
extern const u8 gText_TrainerCardIDNo[];
extern const u8 gText_TrainerCardMoney[];
extern const u8 gText_PokedollarVar1[];
extern const u8 gText_EmptyString6[];
extern const u8 gText_TrainerCardPokedex[];
extern const u8 gText_TrainerCardTime[];
extern const u8 gText_Colon2[];
Expand Down Expand Up @@ -2001,7 +1996,6 @@ extern const u8 gText_BattleArenaGutsSymbol[];
extern const u8 gText_BattleFactoryKnowledgeSymbol[];
extern const u8 gText_BattlePikeLuckSymbol[];
extern const u8 gText_BattlePyramidBraveSymbol[];
extern const u8 gText_EmptyString7[];
extern const u8 gText_BattleTower3[];
extern const u8 gText_BattleDome2[];
extern const u8 gText_BattlePalace2[];
Expand Down
19 changes: 9 additions & 10 deletions src/battle_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ static const u8 sText_ShowHP[] = _("Show HP");
static const u8 sText_SubstituteHp[] = _("Substitute HP");
static const u8 sText_InLove[] = _("In Love");
static const u8 sText_Unknown[] = _("Unknown");
static const u8 sText_EmptyString[] = _("");

static const struct BitfieldInfo sStatus1Bitfield[] =
{
Expand Down Expand Up @@ -656,15 +655,15 @@ static const struct ListMenuItem sVariousListItems[] =

static const struct ListMenuItem sSecondaryListItems[] =
{
{sText_EmptyString, 0},
{sText_EmptyString, 1},
{sText_EmptyString, 2},
{sText_EmptyString, 3},
{sText_EmptyString, 4},
{sText_EmptyString, 5},
{sText_EmptyString, 6},
{sText_EmptyString, 7},
{sText_EmptyString, 8},
{gText_EmptyString, 0},
{gText_EmptyString, 1},
{gText_EmptyString, 2},
{gText_EmptyString, 3},
{gText_EmptyString, 4},
{gText_EmptyString, 5},
{gText_EmptyString, 6},
{gText_EmptyString, 7},
{gText_EmptyString, 8},
};


Expand Down
4 changes: 2 additions & 2 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3928,7 +3928,7 @@ static void TryDoEventsBeforeFirstTurn(void)
TurnValuesCleanUp(FALSE);
SpecialStatusesClear();
*(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags;
BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG);
BattlePutTextOnWindow(gText_EmptyString, B_WIN_MSG);
AssignUsableGimmicks();
gBattleMainFunc = HandleTurnActionSelectionState;
ResetSentPokesToOpponentValue();
Expand Down Expand Up @@ -4051,7 +4051,7 @@ void BattleTurnPassed(void)
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;

*(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags;
BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG);
BattlePutTextOnWindow(gText_EmptyString, B_WIN_MSG);
AssignUsableGimmicks();
SetShellSideArmCategory();
SetAiLogicDataForTurn(AI_DATA); // get assumed abilities, hold effects, etc of all battlers
Expand Down
12 changes: 4 additions & 8 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ EWRAM_DATA struct BattleMsgData *gBattleMsgDataPtr = NULL;

// todo: make some of those names less vague: attacker/target vs pkmn, etc.

static const u8 sText_EmptyString4[] = _("");

const u8 gText_PkmnShroudedInMist[] = _("{B_ATK_TEAM1} team became shrouded in mist!");
const u8 gText_PkmnGettingPumped[] = _("{B_DEF_NAME_WITH_PREFIX} is getting pumped!");
const u8 gText_PkmnsXPreventsSwitching[] = _("{B_BUFF1} is preventing switching out with its {B_LAST_ABILITY} Ability!\p");
Expand Down Expand Up @@ -116,7 +114,6 @@ static const u8 sText_WildPkmnPrefix[] = _("The wild ");
static const u8 sText_FoePkmnPrefix[] = _("The opposing ");
static const u8 sText_WildPkmnPrefixLower[] = _("the wild ");
static const u8 sText_FoePkmnPrefixLower[] = _("the opposing ");
static const u8 sText_EmptyString8[] = _("");
static const u8 sText_FoePkmnPrefix2[] = _("Opposing");
static const u8 sText_AllyPkmnPrefix[] = _("Ally");
static const u8 sText_FoePkmnPrefix3[] = _("Opposing");
Expand Down Expand Up @@ -157,7 +154,6 @@ static const u8 sText_Someones[] = _("someone's");
static const u8 sText_Lanettes[] = _("LANETTE's"); //no decapitalize until it is everywhere
static const u8 sText_EnigmaBerry[] = _("ENIGMA BERRY"); //no decapitalize until it is everywhere
static const u8 sText_BerrySuffix[] = _(" BERRY"); //no decapitalize until it is everywhere
const u8 gText_EmptyString3[] = _("");

static const u8 sText_TwoInGameTrainersDefeated[] = _("You defeated {B_TRAINER1_NAME_WITH_CLASS} and {B_TRAINER2_NAME_WITH_CLASS}!\p");

Expand Down Expand Up @@ -464,7 +460,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_PKMNSITEMRESTOREDHPALITTLE] = COMPOUND_STRING("{B_SCR_NAME_WITH_PREFIX} restored a little HP using its {B_LAST_ITEM}!"),
[STRINGID_ITEMALLOWSONLYYMOVE] = COMPOUND_STRING("{B_LAST_ITEM} only allows the use of {B_CURRENT_MOVE}!\p"),
[STRINGID_PKMNHUNGONWITHX] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} hung on using its {B_LAST_ITEM}!"),
[STRINGID_EMPTYSTRING3] = gText_EmptyString3,
[STRINGID_EMPTYSTRING3] = gText_EmptyString,
[STRINGID_PKMNSXPREVENTSBURNS] = COMPOUND_STRING("{B_EFF_NAME_WITH_PREFIX}'s {B_EFF_ABILITY} prevents burns!"), //not in gen 5+, ability popup
[STRINGID_PKMNSXBLOCKSY] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} blocks {B_CURRENT_MOVE}!"), //not in gen 5+, ability popup
[STRINGID_PKMNSXRESTOREDHPALITTLE2] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} restored its HP a little!"), //not in gen 5+, ability popup
Expand All @@ -489,7 +485,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_PKMNUSEDXTOGETPUMPED] = COMPOUND_STRING("{B_SCR_NAME_WITH_PREFIX} used the {B_LAST_ITEM} to get pumped!"),
[STRINGID_PKMNSXMADEYUSELESS] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} made {B_CURRENT_MOVE} useless!"), //not in gen 5+, ability popup
[STRINGID_PKMNTRAPPEDBYSANDTOMB] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} became trapped by the quicksand!"),
[STRINGID_EMPTYSTRING4] = COMPOUND_STRING(""),
[STRINGID_EMPTYSTRING4] = gText_EmptyString,
[STRINGID_ABOOSTED] = COMPOUND_STRING(" a boosted"),
[STRINGID_PKMNSXINTENSIFIEDSUN] = COMPOUND_STRING("{B_SCR_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY} intensified the sun's rays!"), //not in gen 5+, ability popup
[STRINGID_PKMNMAKESGROUNDMISS] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} makes Ground-type moves miss with {B_DEF_ABILITY}!"), //not in gen 5+, ability popup
Expand Down Expand Up @@ -581,10 +577,10 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_FELLSTRAIGHTDOWN] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} fell straight down!"),
[STRINGID_TARGETCHANGEDTYPE] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} transformed into the {B_BUFF1} type!"),
[STRINGID_PKMNACQUIREDSIMPLE] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} acquired Simple!"), //shouldn't directly use the name
[STRINGID_EMPTYSTRING5] = sText_EmptyString4,
[STRINGID_EMPTYSTRING5] = gText_EmptyString,
[STRINGID_KINDOFFER] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} took the kind offer!"),
[STRINGID_RESETSTARGETSSTATLEVELS] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX}'s stat changes were removed!"),
[STRINGID_EMPTYSTRING6] = sText_EmptyString4,
[STRINGID_EMPTYSTRING6] = gText_EmptyString,
[STRINGID_ALLYSWITCHPOSITION] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} and {B_SCR_NAME_WITH_PREFIX2} switched places!"),
[STRINGID_RESTORETARGETSHEALTH] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX}'s HP was restored!"),
[STRINGID_TOOKPJMNINTOTHESKY] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} took {B_DEF_NAME_WITH_PREFIX2} into the sky!"),
Expand Down
2 changes: 1 addition & 1 deletion src/battle_pyramid_bag.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static const struct MenuAction sMenuActions[] =
[ACTION_GIVE] = { gMenuText_Give, {BagAction_Give} },
[ACTION_CANCEL] = { gText_Cancel2, {BagAction_Cancel} },
[ACTION_USE_BATTLE] = { gMenuText_Use, {BagAction_UseInBattle} },
[ACTION_DUMMY] = { gText_EmptyString2, {NULL} },
[ACTION_DUMMY] = { gText_EmptyString, {NULL} },
};

static const u8 sMenuActionIds_Field[] = {ACTION_USE_FIELD, ACTION_GIVE, ACTION_TOSS, ACTION_CANCEL};
Expand Down
2 changes: 1 addition & 1 deletion src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ void PlayTrainerEncounterMusic(void)
static const u8 *ReturnEmptyStringIfNull(const u8 *string)
{
if (string == NULL)
return gText_EmptyString2;
return gText_EmptyString;
else
return string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/battle_z_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler)
for (i = 0; i < MAX_MON_MOVES; ++i)
{
MoveSelectionDestroyCursorAt(i);
StringCopy(gDisplayedStringBattle, gText_EmptyString2);
StringCopy(gDisplayedStringBattle, gText_EmptyString);
BattlePutTextOnWindow(gDisplayedStringBattle, i + 3);
}

Expand Down
28 changes: 14 additions & 14 deletions src/contest_effect.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void ContestEffect_UserLessEasilyStartled(void)
SetContestantEffectStringID(eContestAppealResults.contestant,CONTEST_STRING_STOPPED_CARING);
}

// Slightly startles the POKéMON in front.
// Slightly startles the POKéMON in front.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the script has messed up és.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they messed up for you? I changes them because they were originally incompatible with python’s regex and showing up as invalid characters in VSCode. They show up as é just fine on GitHub on my end, too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They look like this to me:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, it looks like that on GitHub to me too (at least on my computer, on my phone it looks fine). The diff locally in VSCode (and GitHub Desktop, for reference) looks like I fixed it, if anything:
image

It's weird how this file is the only case where é seems to pose any trouble at all, and I'm not sure why

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably bad system defaults and mixed character encodings crawling in from somewhere.

Edu's screenshot shows an UTF-8 é decoded in ANSI. Python's regexp works in UTF-8, so it's likely that this file ended up with a mixed encoding which throws off autodetection.

A future-proof solution would be to apply encoding=utf-8 to all source files' .gitattributes and review/fix the ANSI remnants within a single run.

static void ContestEffect_StartleFrontMon(void)
{
u8 idx = 0;
Expand Down Expand Up @@ -180,7 +180,7 @@ static void ContestEffect_StartlePrevMons(void)
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Startles the POKéMON that appealed before the user.
// Startles the POKéMON that appealed before the user.
static void ContestEffect_StartlePrevMon2(void)
{
u8 rval = Random() % 10;
Expand All @@ -197,7 +197,7 @@ static void ContestEffect_StartlePrevMon2(void)
ContestEffect_StartleFrontMon();
}

// Startles all POKéMON that appealed before the user.
// Startles all POKéMON that appealed before the user.
static void ContestEffect_StartlePrevMons2(void)
{
u8 numStartled = 0;
Expand Down Expand Up @@ -273,7 +273,7 @@ static void ContestEffect_ShiftJudgeAttention(void)
}
}

// Startles the POKéMON that has the JUDGE's attention.
// Startles the POKéMON that has the JUDGE's attention.
static void ContestEffect_StartleMonWithJudgesAttention(void)
{
u8 numStartled = 0;
Expand Down Expand Up @@ -311,50 +311,50 @@ static void ContestEffect_JamsOthersButMissOneTurn(void)
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Startles POKéMON that made a same-type appeal.
// Startles POKéMON that made a same-type appeal.
static void ContestEffect_StartleMonsSameTypeAppeal(void)
{
u16 move = eContestantStatus[eContestAppealResults.contestant].currMove;
JamByMoveCategory(gMovesInfo[move].contestCategory);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Badly startles POKéMON that made COOL appeals.
// Badly startles POKéMON that made COOL appeals.
static void ContestEffect_StartleMonsCoolAppeal(void)
{
JamByMoveCategory(CONTEST_CATEGORY_COOL);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Badly startles POKéMON that made BEAUTY appeals.
// Badly startles POKéMON that made BEAUTY appeals.
static void ContestEffect_StartleMonsBeautyAppeal(void)
{
JamByMoveCategory(CONTEST_CATEGORY_BEAUTY);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Badly startles POKéMON that made CUTE appeals.
// Badly startles POKéMON that made CUTE appeals.
static void ContestEffect_StartleMonsCuteAppeal(void)
{
JamByMoveCategory(CONTEST_CATEGORY_CUTE);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Badly startles POKéMON that made SMART appeals.
// Badly startles POKéMON that made SMART appeals.
static void ContestEffect_StartleMonsSmartAppeal(void)
{
JamByMoveCategory(CONTEST_CATEGORY_SMART);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Badly startles POKéMON that made TOUGH appeals.
// Badly startles POKéMON that made TOUGH appeals.
static void ContestEffect_StartleMonsToughAppeal(void)
{
JamByMoveCategory(CONTEST_CATEGORY_TOUGH);
SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_ATTEMPT_STARTLE);
}

// Makes one POKéMON after the user nervous.
// Makes one POKéMON after the user nervous.
static void ContestEffect_MakeFollowingMonNervous(void)
{
bool32 hitAny = FALSE;
Expand Down Expand Up @@ -386,7 +386,7 @@ static void ContestEffect_MakeFollowingMonNervous(void)
SetContestantEffectStringID2(eContestAppealResults.contestant, CONTEST_STRING_MESSED_UP2);
}

// Makes all POKéMON after the user nervous.
// Makes all POKéMON after the user nervous.
static void ContestEffect_MakeFollowingMonsNervous(void)
{
u8 numUnnerved = 0;
Expand Down Expand Up @@ -493,7 +493,7 @@ static void ContestEffect_WorsenConditionOfPrevMons(void)
SetContestantEffectStringID2(eContestAppealResults.contestant, CONTEST_STRING_IGNORED);
}

// Badly startles POKéMON in good condition.
// Badly startles POKéMON in good condition.
static void ContestEffect_BadlyStartlesMonsInGoodCondition(void)
{
u8 numHit = 0;
Expand Down Expand Up @@ -892,7 +892,7 @@ static void ContestEffect_ExciteAudienceInAnyContest(void)
}
}

// Badly startles all POKéMON that made good appeals.
// Badly startles all POKéMON that made good appeals.
static void ContestEffect_BadlyStartleMonsWithGoodAppeals(void)
{
int i;
Expand Down
1 change: 1 addition & 0 deletions src/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "constants/rgb.h"
#include "trainer_pokemon_sprites.h"
#include "starter_choose.h"
#include "strings.h"
#include "decompress.h"
#include "intro_credits_graphics.h"
#include "sound.h"
Expand Down
3 changes: 1 addition & 2 deletions src/data/credits.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ enum

#define ENTRIES_PER_PAGE 5

static const u8 sCreditsText_EmptyString[] = _("");
static const u8 sCreditsText_PkmnEmeraldVersion[] = _("POKéMON EMERALD VERSION");
static const u8 sCreditsText_Credits[] = _("Credits");
static const u8 sCreditsText_ExecutiveDirector[] = _("Executive Director");
Expand Down Expand Up @@ -221,7 +220,7 @@ static const u8 sCreditsText_MotoyasuTojima[] = _("Motoyasu Toji
static const u8 sCreditsText_NicolaPrattBarlow[] = _("Nicola Pratt-Barlow");
static const u8 sCreditsText_ShellieDow[] = _("Shellie Dow");
static const u8 sCreditsText_ErikJohnson[] = _("Erik Johnson");
static const struct CreditsEntry sCreditsEntry_EmptyString = { 0, FALSE, sCreditsText_EmptyString};
static const struct CreditsEntry sCreditsEntry_EmptyString = { 0, FALSE, gText_EmptyString};
static const struct CreditsEntry sCreditsEntry_PkmnEmeraldVersion = { 7, TRUE, sCreditsText_PkmnEmeraldVersion};
static const struct CreditsEntry sCreditsEntry_Credits = {11, TRUE, sCreditsText_Credits};
static const struct CreditsEntry sCreditsEntry_ExecutiveDirector = { 8, TRUE, sCreditsText_ExecutiveDirector};
Expand Down
Loading
Loading