Trainer class+name expansion fix for Battle Frontier (#5699)
Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
parent
194f7644b8
commit
e7e701f8ec
1 changed files with 82 additions and 15 deletions
|
@ -2622,6 +2622,10 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
if (*src == PLACEHOLDER_BEGIN)
|
||||
{
|
||||
src++;
|
||||
u32 classLength = 0;
|
||||
u32 nameLength = 0;
|
||||
const u8 *classString;
|
||||
const u8 *nameString;
|
||||
switch (*src)
|
||||
{
|
||||
case B_TXT_BUFF1:
|
||||
|
@ -2800,9 +2804,24 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
break;
|
||||
case B_TXT_TRAINER1_NAME_WITH_CLASS: // trainer1 name with trainer class
|
||||
toCpy = textStart;
|
||||
textStart = StringCopy(textStart, BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A));
|
||||
textStart = StringAppend(textStart, gText_Space2);
|
||||
textStart = StringAppend(textStart, BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, textStart, multiplayerId, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)));
|
||||
classString = BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A);
|
||||
while (classString[classLength] != EOS)
|
||||
{
|
||||
textStart[classLength] = classString[classLength];
|
||||
classLength++;
|
||||
}
|
||||
textStart[classLength] = CHAR_SPACE;
|
||||
textStart += classLength + 1;
|
||||
nameString = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, textStart, multiplayerId, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT));
|
||||
if (nameString != textStart)
|
||||
{
|
||||
while (nameString[nameLength] != EOS)
|
||||
{
|
||||
textStart[nameLength] = nameString[nameLength];
|
||||
nameLength++;
|
||||
}
|
||||
textStart[nameLength] = EOS;
|
||||
}
|
||||
break;
|
||||
case B_TXT_LINK_PLAYER_NAME: // link player name
|
||||
toCpy = gLinkPlayers[multiplayerId].name;
|
||||
|
@ -2922,9 +2941,24 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
break;
|
||||
case B_TXT_TRAINER2_NAME_WITH_CLASS:
|
||||
toCpy = textStart;
|
||||
textStart = StringCopy(textStart, BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_B));
|
||||
textStart = StringAppend(textStart, gText_Space2);
|
||||
textStart = StringAppend(textStart, BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_B, textStart, multiplayerId, GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)));
|
||||
classString = BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_B);
|
||||
while (classString[classLength] != EOS)
|
||||
{
|
||||
textStart[classLength] = classString[classLength];
|
||||
classLength++;
|
||||
}
|
||||
textStart[classLength] = CHAR_SPACE;
|
||||
textStart += classLength + 1;
|
||||
nameString = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_B, textStart, multiplayerId, GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT));
|
||||
if (nameString != textStart)
|
||||
{
|
||||
while (nameString[nameLength] != EOS)
|
||||
{
|
||||
textStart[nameLength] = nameString[nameLength];
|
||||
nameLength++;
|
||||
}
|
||||
textStart[nameLength] = EOS;
|
||||
}
|
||||
break;
|
||||
case B_TXT_TRAINER2_LOSE_TEXT:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
|
@ -2962,9 +2996,24 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
break;
|
||||
case B_TXT_PARTNER_NAME_WITH_CLASS:
|
||||
toCpy = textStart;
|
||||
textStart = StringCopy(textStart, gTrainerClasses[GetFrontierOpponentClass(gPartnerTrainerId)].name);
|
||||
textStart = StringAppend(textStart, gText_Space2);
|
||||
textStart = StringAppend(textStart, BattleStringGetPlayerName(textStart, GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)));
|
||||
classString = gTrainerClasses[GetFrontierOpponentClass(gPartnerTrainerId)].name;
|
||||
while (classString[classLength] != EOS)
|
||||
{
|
||||
textStart[classLength] = classString[classLength];
|
||||
classLength++;
|
||||
}
|
||||
textStart[classLength] = CHAR_SPACE;
|
||||
textStart += classLength + 1;
|
||||
nameString = BattleStringGetPlayerName(textStart, GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT));
|
||||
if (nameString != textStart)
|
||||
{
|
||||
while (nameString[nameLength] != EOS)
|
||||
{
|
||||
textStart[nameLength] = nameString[nameLength];
|
||||
nameLength++;
|
||||
}
|
||||
textStart[nameLength] = EOS;
|
||||
}
|
||||
break;
|
||||
case B_TXT_ATK_TRAINER_NAME:
|
||||
toCpy = BattleStringGetTrainerName(text, multiplayerId, gBattlerAttacker);
|
||||
|
@ -2995,24 +3044,42 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
}
|
||||
else
|
||||
{
|
||||
classString = NULL;
|
||||
switch (GetBattlerPosition(gBattlerAttacker))
|
||||
{
|
||||
case B_POSITION_PLAYER_RIGHT:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
textStart = StringCopy(textStart, gTrainerClasses[GetFrontierOpponentClass(gPartnerTrainerId)].name);
|
||||
classString = gTrainerClasses[GetFrontierOpponentClass(gPartnerTrainerId)].name;
|
||||
break;
|
||||
case B_POSITION_OPPONENT_LEFT:
|
||||
textStart = StringCopy(textStart, BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A));
|
||||
classString = BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A);
|
||||
break;
|
||||
case B_POSITION_OPPONENT_RIGHT:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && !BATTLE_TWO_VS_ONE_OPPONENT)
|
||||
textStart = StringCopy(textStart, BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_B));
|
||||
classString = BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_B);
|
||||
else
|
||||
textStart = StringCopy(textStart, BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A));
|
||||
classString = BattleStringGetOpponentClassByTrainerId(gTrainerBattleOpponent_A);
|
||||
break;
|
||||
}
|
||||
textStart = StringAppend(textStart, gText_Space2);
|
||||
textStart = StringAppend(textStart, BattleStringGetTrainerName(textStart, multiplayerId, gBattlerAttacker));
|
||||
classLength = 0;
|
||||
nameLength = 0;
|
||||
while (classString[classLength] != EOS)
|
||||
{
|
||||
textStart[classLength] = classString[classLength];
|
||||
classLength++;
|
||||
}
|
||||
textStart[classLength] = CHAR_SPACE;
|
||||
textStart += 1 + classLength;
|
||||
nameString = BattleStringGetTrainerName(textStart, multiplayerId, gBattlerAttacker);
|
||||
if (nameString != textStart)
|
||||
{
|
||||
while (nameString[nameLength] != EOS)
|
||||
{
|
||||
textStart[nameLength] = nameString[nameLength];
|
||||
nameLength++;
|
||||
}
|
||||
textStart[nameLength] = EOS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_TXT_ATK_TEAM1:
|
||||
|
|
Loading…
Reference in a new issue