mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Automatically update nickname buffer sizes
This commit is contained in:
parent
da238562f0
commit
65fee186f8
@ -1,7 +1,11 @@
|
||||
#ifndef GUARD_BATTLE_MESSAGE_H
|
||||
#define GUARD_BATTLE_MESSAGE_H
|
||||
|
||||
#define TEXT_BUFF_ARRAY_COUNT 16
|
||||
// This buffer can hold many different things. Some of the things it can hold
|
||||
// that have explicit sizes are listed below to ensure it can contain them.
|
||||
#define TEXT_BUFF_ARRAY_COUNT max(16, \
|
||||
max(MOVE_NAME_LENGTH + 2, /* +2 to hold the "!" and EOS. */ \
|
||||
POKEMON_NAME_LENGTH + 1))
|
||||
|
||||
// for 0xFD
|
||||
#define B_TXT_BUFF1 0x0
|
||||
|
@ -92,6 +92,7 @@
|
||||
// string lengths
|
||||
#define ITEM_NAME_LENGTH 14
|
||||
#define POKEMON_NAME_LENGTH 10
|
||||
#define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary
|
||||
#define PLAYER_NAME_LENGTH 7
|
||||
#define MAIL_WORDS_COUNT 9
|
||||
#define EASY_CHAT_BATTLE_WORDS_COUNT 6
|
||||
|
@ -556,7 +556,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -450,7 +450,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -561,7 +561,7 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -1608,7 +1608,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -634,7 +634,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -542,7 +542,7 @@ static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -525,7 +525,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -452,7 +452,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
struct MovePpInfo moveData;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 *src;
|
||||
s16 data16;
|
||||
u32 data32;
|
||||
|
@ -1323,7 +1323,8 @@ const u8 gText_Draw[] = _("{HIGHLIGHT TRANSPARENT}Draw");
|
||||
static const u8 sText_SpaceIs[] = _(" is");
|
||||
static const u8 sText_ApostropheS[] = _("'s");
|
||||
|
||||
// For displaying names of invalid moves
|
||||
// For displaying names of invalid moves.
|
||||
// This is large enough that the text for TYPE_ELECTRIC will exceed TEXT_BUFF_ARRAY_COUNT.
|
||||
static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17] =
|
||||
{
|
||||
[TYPE_NORMAL] = _("a NORMAL move"),
|
||||
@ -1472,7 +1473,7 @@ static const u16 sGrammarMoveUsedTable[] =
|
||||
MOVE_COVET, 0
|
||||
};
|
||||
|
||||
static const u8 sDummyWeirdStatusString[] = {EOS, EOS, EOS, EOS, EOS, EOS, EOS, EOS, 0, 0};
|
||||
static const u8 sText_EmptyStatus[] = _("$$$$$$$");
|
||||
|
||||
static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
|
||||
{
|
||||
@ -2259,10 +2260,10 @@ static const u8 *TryGetStatusString(u8 *src)
|
||||
u32 chars1, chars2;
|
||||
u8 *statusPtr;
|
||||
|
||||
memcpy(status, sDummyWeirdStatusString, 8);
|
||||
memcpy(status, sText_EmptyStatus, min(ARRAY_COUNT(status), ARRAY_COUNT(sText_EmptyStatus)));
|
||||
|
||||
statusPtr = status;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < ARRAY_COUNT(status); i++)
|
||||
{
|
||||
if (*src == EOS) break; // one line required to match -g
|
||||
*statusPtr = *src;
|
||||
@ -2304,11 +2305,16 @@ static const u8 *TryGetStatusString(u8 *src)
|
||||
StringGet_Nickname(text); \
|
||||
toCpy = text;
|
||||
|
||||
// Ensure the defined length for an item name can contain the full defined length of a berry name.
|
||||
// This ensures that custom Enigma Berry names will fit in the text buffer at the top of BattleStringExpandPlaceholders.
|
||||
STATIC_ASSERT(BERRY_NAME_LENGTH + 1 + ARRAY_COUNT(sText_BerrySuffix) <= ITEM_NAME_LENGTH, BerryNameTooLong);
|
||||
|
||||
u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
{
|
||||
u32 dstID = 0; // if they used dstID, why not use srcID as well?
|
||||
const u8 *toCpy = NULL;
|
||||
u8 text[30];
|
||||
// This buffer may hold either the name of a trainer, pokemon, or item.
|
||||
u8 text[max(max(max(32, TRAINER_NAME_LENGTH + 1), POKEMON_NAME_LENGTH + 1), ITEM_NAME_LENGTH)];
|
||||
u8 multiplayerId;
|
||||
s32 i;
|
||||
|
||||
@ -2753,7 +2759,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
||||
{
|
||||
u32 srcID = 1;
|
||||
u32 value = 0;
|
||||
u8 text[12];
|
||||
u8 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
u16 hword;
|
||||
|
||||
*dst = EOS;
|
||||
@ -2793,7 +2799,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
||||
case B_BUFF_MON_NICK_WITH_PREFIX: // poke nick with prefix
|
||||
if (GetBattlerSide(src[srcID + 1]) == B_SIDE_PLAYER)
|
||||
{
|
||||
GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, text);
|
||||
GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, nickname);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2802,10 +2808,10 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
||||
else
|
||||
StringAppend(dst, sText_WildPkmnPrefix);
|
||||
|
||||
GetMonData(&gEnemyParty[src[srcID + 2]], MON_DATA_NICKNAME, text);
|
||||
GetMonData(&gEnemyParty[src[srcID + 2]], MON_DATA_NICKNAME, nickname);
|
||||
}
|
||||
StringGet_Nickname(text);
|
||||
StringAppend(dst, text);
|
||||
StringGet_Nickname(nickname);
|
||||
StringAppend(dst, nickname);
|
||||
srcID += 3;
|
||||
break;
|
||||
case B_BUFF_STAT: // stats
|
||||
|
@ -2775,7 +2775,7 @@ static bool8 IsPlayerLinkLeader(void)
|
||||
|
||||
void CreateContestMonFromParty(u8 partyIndex)
|
||||
{
|
||||
u8 name[20];
|
||||
u8 name[max(PLAYER_NAME_LENGTH + 1, POKEMON_NAME_BUFFER_SIZE)];
|
||||
u16 heldItem;
|
||||
s16 cool;
|
||||
s16 beauty;
|
||||
@ -2785,10 +2785,8 @@ void CreateContestMonFromParty(u8 partyIndex)
|
||||
|
||||
StringCopy(name, gSaveBlock2Ptr->playerName);
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
StripPlayerNameForLinkContest(name);
|
||||
}
|
||||
memcpy(gContestMons[gContestPlayerMonIndex].trainerName, name, 8);
|
||||
memcpy(gContestMons[gContestPlayerMonIndex].trainerName, name, PLAYER_NAME_LENGTH + 1);
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
gContestMons[gContestPlayerMonIndex].trainerGfxId = OBJ_EVENT_GFX_LINK_BRENDAN;
|
||||
else
|
||||
@ -6020,8 +6018,10 @@ static u8 GetMonNicknameLanguage(u8 *nickname)
|
||||
if (nickname[0] == EXT_CTRL_CODE_BEGIN && nickname[1] == EXT_CTRL_CODE_JPN)
|
||||
return GAME_LANGUAGE;
|
||||
|
||||
if (StringLength(nickname) < PLAYER_NAME_LENGTH - 1)
|
||||
if (StringLength(nickname) <= 5)
|
||||
{
|
||||
// Name is short enough that it might be Japanese.
|
||||
// Make sure all the character values are valid latin name characters.
|
||||
while (*nickname != EOS)
|
||||
{
|
||||
if ((*nickname >= CHAR_A && *nickname <= CHAR_z)
|
||||
@ -6039,12 +6039,18 @@ static u8 GetMonNicknameLanguage(u8 *nickname)
|
||||
|| *nickname == CHAR_DBL_QUOTE_LEFT
|
||||
|| *nickname == CHAR_DBL_QUOTE_RIGHT
|
||||
|| *nickname == CHAR_SGL_QUOTE_LEFT
|
||||
|| *nickname == CHAR_DBL_QUOTE_LEFT) // Most likely a typo, CHAR_SGL_QUOTE_RIGHT should be here instead.
|
||||
#ifdef BUGFIX
|
||||
|| *nickname == CHAR_SGL_QUOTE_RIGHT
|
||||
#else
|
||||
|| *nickname == CHAR_DBL_QUOTE_LEFT // Most likely a typo, CHAR_SGL_QUOTE_RIGHT should be here instead.
|
||||
#endif
|
||||
)
|
||||
{
|
||||
nickname++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid latin name character, assume the name was Japanese.
|
||||
ret = LANGUAGE_JAPANESE;
|
||||
break;
|
||||
}
|
||||
@ -6101,7 +6107,7 @@ void StripPlayerAndMonNamesForLinkContest(struct ContestPokemon *mon, s32 langua
|
||||
name = mon->trainerName;
|
||||
if (language == LANGUAGE_JAPANESE)
|
||||
{
|
||||
name[PLAYER_NAME_LENGTH] = EOS;
|
||||
name[7] = EOS;
|
||||
name[6] = name[4];
|
||||
name[5] = name[3];
|
||||
name[4] = name[2];
|
||||
|
@ -93,16 +93,14 @@ static const u8 sJapaneseEggNickname[] = _("タマゴ"); // "tamago" ("egg" in J
|
||||
|
||||
u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
GetMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
return StringCopy_Nickname(dest, nickname);
|
||||
}
|
||||
|
||||
u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
GetBoxMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
return StringCopy_Nickname(dest, nickname);
|
||||
}
|
||||
@ -946,12 +944,12 @@ static bool8 IsEggPending(struct DayCare *daycare)
|
||||
// gStringVar3 = first mon trainer's name
|
||||
static void _GetDaycareMonNicknames(struct DayCare *daycare)
|
||||
{
|
||||
u8 text[12];
|
||||
u8 otName[max(12, PLAYER_NAME_LENGTH + 1)];
|
||||
if (GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) != 0)
|
||||
{
|
||||
GetBoxMonNickname(&daycare->mons[0].mon, gStringVar1);
|
||||
GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, text);
|
||||
StringCopy(gStringVar3, text);
|
||||
GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, otName);
|
||||
StringCopy(gStringVar3, otName);
|
||||
}
|
||||
|
||||
if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0)
|
||||
@ -1146,7 +1144,7 @@ static u8 *AppendMonGenderSymbol(u8 *name, struct BoxPokemon *boxMon)
|
||||
|
||||
static void GetDaycareLevelMenuText(struct DayCare *daycare, u8 *dest)
|
||||
{
|
||||
u8 monNames[DAYCARE_MON_COUNT][20];
|
||||
u8 monNames[DAYCARE_MON_COUNT][POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 i;
|
||||
|
||||
*dest = EOS;
|
||||
@ -1204,8 +1202,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
||||
|
||||
static void DaycarePrintMonNickname(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
GetBoxMonNickname(&daycare->mons[daycareSlotId].mon, nickname);
|
||||
AppendMonGenderSymbol(nickname, &daycare->mons[daycareSlotId].mon);
|
||||
DaycareAddTextPrinter(windowId, nickname, 8, y);
|
||||
|
@ -399,7 +399,7 @@ void ScriptHatchMon(void)
|
||||
|
||||
static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId)
|
||||
{
|
||||
u8 nickname[32];
|
||||
u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)];
|
||||
struct DaycareMon *daycareMon = &daycare->mons[daycareId];
|
||||
|
||||
GetBoxMonNickname(&daycareMon->mon, nickname);
|
||||
|
@ -208,7 +208,7 @@ void BeginEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopE
|
||||
|
||||
void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId)
|
||||
{
|
||||
u8 name[20];
|
||||
u8 name[POKEMON_NAME_BUFFER_SIZE];
|
||||
u16 currSpecies;
|
||||
u32 trainerId, personality;
|
||||
const struct CompressedSpritePalette* pokePal;
|
||||
@ -467,7 +467,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
|
||||
|
||||
void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSpriteId, u8 partyId)
|
||||
{
|
||||
u8 name[20];
|
||||
u8 name[POKEMON_NAME_BUFFER_SIZE];
|
||||
u16 currSpecies;
|
||||
u32 trainerId, personality;
|
||||
const struct CompressedSpritePalette* pokePal;
|
||||
@ -775,8 +775,7 @@ static void Task_EvolutionScene(u8 taskId)
|
||||
var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped)
|
||||
{
|
||||
u8 text[20];
|
||||
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
if (!(gTasks[taskId].tBits & TASK_BIT_LEARN_MOVE))
|
||||
{
|
||||
StopMapMusic();
|
||||
@ -786,8 +785,8 @@ static void Task_EvolutionScene(u8 taskId)
|
||||
gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE;
|
||||
gTasks[taskId].tLearnsFirstMove = FALSE;
|
||||
gTasks[taskId].tLearnMoveState = MVSTATE_INTRO_MSG_1;
|
||||
GetMonData(mon, MON_DATA_NICKNAME, text);
|
||||
StringCopy_Nickname(gBattleTextBuff1, text);
|
||||
GetMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(gBattleTextBuff1, nickname);
|
||||
|
||||
if (var == MON_HAS_MAX_MOVES)
|
||||
gTasks[taskId].tState = EVOSTATE_REPLACE_MOVE;
|
||||
@ -1195,13 +1194,12 @@ static void Task_TradeEvolutionScene(u8 taskId)
|
||||
var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped)
|
||||
{
|
||||
u8 text[20];
|
||||
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE;
|
||||
gTasks[taskId].tLearnsFirstMove = FALSE;
|
||||
gTasks[taskId].tLearnMoveState = 0;
|
||||
GetMonData(mon, MON_DATA_NICKNAME, text);
|
||||
StringCopy_Nickname(gBattleTextBuff1, text);
|
||||
GetMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(gBattleTextBuff1, nickname);
|
||||
|
||||
if (var == MON_HAS_MAX_MOVES)
|
||||
gTasks[taskId].tState = T_EVOSTATE_REPLACE_MOVE;
|
||||
|
@ -44,7 +44,7 @@ struct HallofFameMon
|
||||
u32 personality;
|
||||
u16 species:9;
|
||||
u16 lvl:7;
|
||||
u8 nick[POKEMON_NAME_LENGTH];
|
||||
u8 nickname[POKEMON_NAME_LENGTH];
|
||||
};
|
||||
|
||||
struct HallofFameTeam
|
||||
@ -338,7 +338,7 @@ static const struct HallofFameMon sDummyFameMon =
|
||||
.personality = 0,
|
||||
.species = SPECIES_NONE,
|
||||
.lvl = 0,
|
||||
.nick = {0}
|
||||
.nickname = {0}
|
||||
};
|
||||
|
||||
// Unused, order of party slots on Hall of Fame screen
|
||||
@ -442,18 +442,16 @@ static void Task_Hof_InitMonData(u8 taskId)
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
u8 nick[POKEMON_NAME_LENGTH + 2];
|
||||
u8 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES))
|
||||
{
|
||||
sHofMonPtr->mon[i].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG);
|
||||
sHofMonPtr->mon[i].tid = GetMonData(&gPlayerParty[i], MON_DATA_OT_ID);
|
||||
sHofMonPtr->mon[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY);
|
||||
sHofMonPtr->mon[i].lvl = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL);
|
||||
GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nick);
|
||||
GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nickname);
|
||||
for (j = 0; j < POKEMON_NAME_LENGTH; j++)
|
||||
{
|
||||
sHofMonPtr->mon[i].nick[j] = nick[j];
|
||||
}
|
||||
sHofMonPtr->mon[i].nickname[j] = nickname[j];
|
||||
gTasks[taskId].tMonNumber++;
|
||||
}
|
||||
else
|
||||
@ -462,7 +460,7 @@ static void Task_Hof_InitMonData(u8 taskId)
|
||||
sHofMonPtr->mon[i].tid = 0;
|
||||
sHofMonPtr->mon[i].personality = 0;
|
||||
sHofMonPtr->mon[i].lvl = 0;
|
||||
sHofMonPtr->mon[i].nick[0] = EOS;
|
||||
sHofMonPtr->mon[i].nickname[0] = EOS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1115,7 +1113,7 @@ static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2)
|
||||
|
||||
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2)
|
||||
{
|
||||
u8 text[30];
|
||||
u8 text[max(32, POKEMON_NAME_LENGTH + 1)];
|
||||
u8 *stringPtr;
|
||||
s32 dexNumber;
|
||||
s32 width;
|
||||
@ -1148,8 +1146,8 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u
|
||||
AddTextPrinterParameterized3(0, FONT_NORMAL, 0x10, 1, sMonInfoTextColors, TEXT_SKIP_DRAW, text);
|
||||
}
|
||||
|
||||
// nick, species names, gender and level
|
||||
memcpy(text, currMon->nick, POKEMON_NAME_LENGTH);
|
||||
// nickname, species names, gender and level
|
||||
memcpy(text, currMon->nickname, POKEMON_NAME_LENGTH);
|
||||
text[POKEMON_NAME_LENGTH] = EOS;
|
||||
if (currMon->species == SPECIES_EGG)
|
||||
{
|
||||
|
@ -918,7 +918,7 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
||||
*(dst++) = TEXT_COLOR_TRANSPARENT;
|
||||
*(dst++) = TEXT_COLOR_LIGHT_BLUE;
|
||||
if (GetBoxOrPartyMonData(box, mon, MON_DATA_IS_EGG, NULL))
|
||||
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
|
||||
return StringCopyPadded(dst, gText_EggNickname, 0, POKEMON_NAME_LENGTH + 2);
|
||||
GetBoxOrPartyMonData(box, mon, MON_DATA_NICKNAME, dst);
|
||||
StringGet_Nickname(dst);
|
||||
species = GetBoxOrPartyMonData(box, mon, MON_DATA_SPECIES, NULL);
|
||||
@ -1020,7 +1020,7 @@ void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId
|
||||
locationDst[3] = TEXT_COLOR_TRANSPARENT;
|
||||
locationDst[4] = TEXT_COLOR_LIGHT_BLUE;
|
||||
if (box == TOTAL_BOXES_COUNT) // Party mon.
|
||||
BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, 8);
|
||||
BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, BOX_NAME_LENGTH);
|
||||
else
|
||||
BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(box), BOX_NAME_LENGTH);
|
||||
}
|
||||
@ -1029,7 +1029,7 @@ void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId
|
||||
for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++)
|
||||
nameDst[i] = CHAR_SPACE;
|
||||
nameDst[i] = EOS;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < BOX_NAME_LENGTH; i++)
|
||||
locationDst[i] = CHAR_SPACE;
|
||||
locationDst[i] = EOS;
|
||||
}
|
||||
|
@ -2406,7 +2406,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI
|
||||
void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
|
||||
{
|
||||
s32 i;
|
||||
u8 nickname[30];
|
||||
u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)];
|
||||
u8 language;
|
||||
u8 value;
|
||||
|
||||
@ -2460,7 +2460,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
|
||||
void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50)
|
||||
{
|
||||
s32 i;
|
||||
u8 nickname[30];
|
||||
u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)];
|
||||
u8 level;
|
||||
u8 language;
|
||||
u8 value;
|
||||
@ -4629,7 +4629,7 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
|
||||
{
|
||||
u16 *hpSwitchout;
|
||||
s32 i;
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
|
||||
gBattleMons[battlerId].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL);
|
||||
gBattleMons[battlerId].item = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM, NULL);
|
||||
|
@ -348,7 +348,7 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding)
|
||||
*(str++) = TEXT_COLOR_LIGHT_BLUE;
|
||||
|
||||
if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL))
|
||||
return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, 12);
|
||||
return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, POKEMON_NAME_LENGTH + 2);
|
||||
|
||||
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, str);
|
||||
StringGet_Nickname(str);
|
||||
@ -445,7 +445,7 @@ static void CopyMonNameGenderLocation(s16 listId, u8 loadId)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 12; i++)
|
||||
for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++)
|
||||
menu->nameText[loadId][i] = CHAR_SPACE;
|
||||
menu->nameText[loadId][i] = EOS;
|
||||
|
||||
|
14
src/trade.c
14
src/trade.c
@ -1864,7 +1864,7 @@ static void SetSelectedMon(u8 cursorPosition)
|
||||
static void DrawSelectedMonScreen(u8 whichParty)
|
||||
{
|
||||
s8 nameStringWidth;
|
||||
u8 nickname[20];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 movesString[56];
|
||||
u8 i;
|
||||
u8 partyIdx;
|
||||
@ -1950,7 +1950,7 @@ static void DrawSelectedMonScreen(u8 whichParty)
|
||||
|
||||
static u8 GetMonNicknameWidth(u8 *str, u8 whichParty, u8 partyIdx)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH];
|
||||
u8 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
|
||||
if (whichParty == TRADE_PLAYER)
|
||||
GetMonData(&gPlayerParty[partyIdx], MON_DATA_NICKNAME, nickname);
|
||||
@ -2006,8 +2006,8 @@ static void PrintPartyMonNickname(u8 whichParty, u8 windowId, u8 *nickname)
|
||||
static void PrintPartyNicknames(u8 whichParty)
|
||||
{
|
||||
u8 i;
|
||||
u8 nickname[20];
|
||||
u8 str[32];
|
||||
u8 nickname[POKEMON_NAME_BUFFER_SIZE];
|
||||
u8 str[max(32, POKEMON_NAME_BUFFER_SIZE)];
|
||||
struct Pokemon *party = (whichParty == TRADE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||
|
||||
for (i = 0; i < sTradeMenu->partyCounts[whichParty]; i++)
|
||||
@ -2023,7 +2023,7 @@ static void PrintLevelAndGender(u8 whichParty, u8 monIdx, u8 x, u8 y, u8 width,
|
||||
u8 level;
|
||||
u32 symbolTile;
|
||||
u8 gender;
|
||||
u8 nickname[POKEMON_NAME_LENGTH];
|
||||
u8 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gTradeMenuMonBox_Tilemap, width, height, 6, 3, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
@ -3330,7 +3330,7 @@ static void LoadTradeSequenceSpriteSheetsAndPalettes(void)
|
||||
static void BufferTradeSceneStrings(void)
|
||||
{
|
||||
u8 mpId;
|
||||
u8 name[20];
|
||||
u8 name[POKEMON_NAME_BUFFER_SIZE];
|
||||
const struct InGameTrade *ingameTrade;
|
||||
|
||||
if (sTradeAnim->isLinkTrade)
|
||||
@ -4539,7 +4539,7 @@ u16 GetInGameTradeSpeciesInfo(void)
|
||||
|
||||
static void BufferInGameTradeMonName(void)
|
||||
{
|
||||
u8 nickname[32];
|
||||
u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)];
|
||||
const struct InGameTrade *inGameTrade = &sIngameTrades[gSpecialVar_0x8004];
|
||||
GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(gStringVar1, nickname);
|
||||
|
Loading…
Reference in New Issue
Block a user