Convert gBattleStringsTable to COMPOUND_STRINGs (#5649)

This commit is contained in:
Eduardo Quezada 2024-11-09 20:22:37 -03:00 committed by GitHub
parent e005ffb576
commit 5f87d2e8a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 774 additions and 1511 deletions

View file

@ -317,9 +317,9 @@ extern const u8 gText_Loss[];
extern const u8 gText_Draw[];
extern const u8 gText_StatSharply[];
extern const u8 gText_StatRose[];
extern const u8 sText_StatFell[];
extern const u8 sText_drastically[];
extern const u8 sText_severely[];
extern const u8 gText_StatFell[];
extern const u8 gText_drastically[];
extern const u8 gText_severely[];
extern const u8 gText_DefendersStatRose[];
extern const u8 gText_PkmnGettingPumped[];
extern const u8 gText_PkmnShroudedInMist[];

File diff suppressed because it is too large Load diff

View file

@ -862,7 +862,7 @@ static void Task_EvolutionScene(u8 taskId)
{
BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(MUS_LEVEL_UP);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskId].tState++;
@ -880,7 +880,7 @@ static void Task_EvolutionScene(u8 taskId)
{
// "{mon} is trying to learn {move}"
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveState++;
}
@ -889,7 +889,7 @@ static void Task_EvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
// "But, {mon} can't learn more than four moves"
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveState++;
}
@ -898,7 +898,7 @@ static void Task_EvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
// "Delete a move to make room for {move}?"
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveYesState = MVSTATE_SHOW_MOVE_SELECT;
gTasks[taskId].tLearnMoveNoState = MVSTATE_ASK_CANCEL;
@ -986,7 +986,7 @@ static void Task_EvolutionScene(u8 taskId)
if (IsMoveHM(move))
{
// Can't forget HMs
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveState = MVSTATE_RETRY_AFTER_HM;
}
@ -1003,14 +1003,14 @@ static void Task_EvolutionScene(u8 taskId)
}
break;
case MVSTATE_FORGET_MSG_1:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveState++;
break;
case MVSTATE_FORGET_MSG_2:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveState++;
}
@ -1018,20 +1018,20 @@ static void Task_EvolutionScene(u8 taskId)
case MVSTATE_LEARNED_MOVE:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tState = EVOSTATE_LEARNED_MOVE;
}
break;
case MVSTATE_ASK_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tLearnMoveYesState = MVSTATE_CANCEL;
gTasks[taskId].tLearnMoveNoState = MVSTATE_INTRO_MSG_1;
gTasks[taskId].tLearnMoveState = MVSTATE_PRINT_YES_NO;
break;
case MVSTATE_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE;
break;
@ -1265,7 +1265,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
{
BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(MUS_LEVEL_UP);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskId].tState++;
@ -1283,7 +1283,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
{
// "{mon} is trying to learn {move}"
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState++;
}
@ -1292,7 +1292,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
// "But, {mon} can't learn more than four moves"
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState++;
}
@ -1301,7 +1301,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
// "Delete a move to make room for {move}?"
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveYesState = T_MVSTATE_SHOW_MOVE_SELECT;
gTasks[taskId].tLearnMoveNoState = T_MVSTATE_ASK_CANCEL;
@ -1322,7 +1322,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
{
case 0: // YES
sEvoCursorPos = 0;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveYesState;
if (gTasks[taskId].tLearnMoveState == T_MVSTATE_SHOW_MOVE_SELECT)
@ -1331,7 +1331,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
case 1: // NO
case MENU_B_PRESSED:
sEvoCursorPos = 1;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState;
break;
@ -1370,7 +1370,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (IsMoveHM(move))
{
// Can't forget HMs
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState = T_MVSTATE_RETRY_AFTER_HM;
}
@ -1381,7 +1381,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
RemoveMonPPBonus(mon, var);
SetMonMoveSlot(mon, gMoveToLearn, var);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState++;
}
@ -1391,7 +1391,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
case T_MVSTATE_FORGET_MSG:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState++;
}
@ -1399,20 +1399,20 @@ static void Task_TradeEvolutionScene(u8 taskId)
case T_MVSTATE_LEARNED_MOVE:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tState = T_EVOSTATE_LEARNED_MOVE;
}
break;
case T_MVSTATE_ASK_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveYesState = T_MVSTATE_CANCEL;
gTasks[taskId].tLearnMoveNoState = T_MVSTATE_INTRO_MSG_1;
gTasks[taskId].tLearnMoveState = T_MVSTATE_PRINT_YES_NO;
break;
case T_MVSTATE_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE;
break;

View file

@ -664,7 +664,7 @@ TEST("Battle strings fit on the battle message window")
for (i = start; i <= end; i++)
{
PARAMETRIZE_LABEL("%S", gBattleStringsTable[i - BATTLESTRINGS_TABLE_START]) { battleStringId = i - BATTLESTRINGS_TABLE_START; }
PARAMETRIZE_LABEL("%S", gBattleStringsTable[i]) { battleStringId = i; }
}
// Clear buffers
@ -706,7 +706,7 @@ TEST("Battle strings fit on the battle message window")
// In cases where a buffer is used with multiple contexts, the widest string is used.
// Eg. STRINGID_CANACTFASTERTHANKSTO is used for both with abilities and items,
// so ability is chosen because it's longer.
switch (battleStringId + BATTLESTRINGS_TABLE_START)
switch (battleStringId)
{
// Testing Trainer messages is out of the current scope for this test.
case STRINGID_TRAINER1LOSETEXT:
@ -858,15 +858,15 @@ TEST("Battle strings fit on the battle message window")
case STRINGID_DEFENDERSSTATROSE:
case STRINGID_USINGITEMSTATOFPKMNROSE:
StringCopy(gBattleTextBuff1, gStatNamesTable[longStatName]);
StringCopy(gBattleTextBuff2, sText_drastically);
StringCopy(gBattleTextBuff2, gText_drastically);
StringAppend(gBattleTextBuff2, gText_StatRose);
break;
// Buffer Stat name to B_BUFF1, "severely fell" to B_BUFF2
case STRINGID_ATTACKERSSTATFELL:
case STRINGID_DEFENDERSSTATFELL:
StringCopy(gBattleTextBuff1, gStatNamesTable[longStatName]);
StringCopy(gBattleTextBuff2, sText_severely);
StringAppend(gBattleTextBuff2, sText_StatFell);
StringCopy(gBattleTextBuff2, gText_severely);
StringAppend(gBattleTextBuff2, gText_StatFell);
break;
// Buffer Status name to B_BUFF2
case STRINGID_PKMNSITEMCUREDPROBLEM:
@ -887,7 +887,7 @@ TEST("Battle strings fit on the battle message window")
break;
}
BattleStringExpandPlaceholders(gBattleStringsTable[battleStringId], battleString, BATTLE_STRING_BUFFER_SIZE);
DebugPrintf("Battle String ID %d: %S", battleStringId + BATTLESTRINGS_TABLE_START, battleString);
DebugPrintf("Battle String ID %d: %S", battleStringId, battleString);
for (j = 1;; j++)
{
strWidth = GetStringLineWidth(fontId, battleString, 0, j, BATTLE_STRING_BUFFER_SIZE);