summaryrefslogtreecommitdiff
path: root/src/menu_specialized.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu_specialized.c')
-rw-r--r--src/menu_specialized.c134
1 files changed, 62 insertions, 72 deletions
diff --git a/src/menu_specialized.c b/src/menu_specialized.c
index 1d317a1aa..7de963893 100644
--- a/src/menu_specialized.c
+++ b/src/menu_specialized.c
@@ -880,89 +880,82 @@ s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
// Gets the name/gender/level string for the condition menu
static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
{
- u16 species, level, gender;
+ u16 box, mon, species, level, gender;
struct BoxPokemon *boxMon;
u8 *str;
+ box = boxId;
+ mon = monId;
*(dst++) = EXT_CTRL_CODE_BEGIN;
*(dst++) = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
*(dst++) = TEXT_COLOR_BLUE;
*(dst++) = TEXT_COLOR_TRANSPARENT;
*(dst++) = TEXT_COLOR_LIGHT_BLUE;
- if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL))
- {
+ if (GetBoxOrPartyMonData(box, mon, MON_DATA_IS_EGG, NULL))
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
+ GetBoxOrPartyMonData(box, mon, MON_DATA_NICKNAME, dst);
+ StringGetEnd10(dst);
+ species = GetBoxOrPartyMonData(box, mon, MON_DATA_SPECIES, NULL);
+ if (box == TOTAL_BOXES_COUNT) // Party mon.
+ {
+ level = GetMonData(&gPlayerParty[mon], MON_DATA_LEVEL);
+ gender = GetMonGender(&gPlayerParty[mon]);
}
else
{
- GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst);
- StringGetEnd10(dst);
- species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
- if (boxId == TOTAL_BOXES_COUNT) // Party mon.
- {
- level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
- gender = GetMonGender(&gPlayerParty[monId]);
- }
- else
- {
- // Needed to match, feel free to remove.
- boxId++;boxId--;
- monId++;monId--;
+ boxMon = GetBoxedMonPtr(box, mon);
+ gender = GetBoxMonGender(boxMon);
+ level = GetLevelFromBoxMonExp(boxMon);
+ }
- boxMon = GetBoxedMonPtr(boxId, monId);
- gender = GetBoxMonGender(boxMon);
- level = GetLevelFromBoxMonExp(boxMon);
- }
+ if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species]))
+ gender = MON_GENDERLESS;
- if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species]))
- gender = MON_GENDERLESS;
+ for (str = dst; *str != EOS; str++)
+ ;
- for (str = dst; *str != EOS; str++)
- ;
+ *(str++) = EXT_CTRL_CODE_BEGIN;
+ *(str++) = EXT_CTRL_CODE_SKIP;
+ *(str++) = 60;
+ switch (gender)
+ {
+ default:
+ *(str++) = CHAR_SPACE;
+ break;
+ case MON_MALE:
*(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_SKIP;
- *(str++) = 60;
-
- switch (gender)
- {
- default:
- *(str++) = CHAR_SPACE;
- break;
- case MON_MALE:
- *(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_COLOR;
- *(str++) = TEXT_COLOR_RED;
- *(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_SHADOW;
- *(str++) = TEXT_COLOR_LIGHT_RED;
- *(str++) = CHAR_MALE;
- break;
- case MON_FEMALE:
- *(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_COLOR;
- *(str++) = TEXT_COLOR_GREEN;
- *(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_SHADOW;
- *(str++) = TEXT_COLOR_LIGHT_GREEN;
- *(str++) = CHAR_FEMALE;
- break;
- }
-
+ *(str++) = EXT_CTRL_CODE_COLOR;
+ *(str++) = TEXT_COLOR_RED;
*(str++) = EXT_CTRL_CODE_BEGIN;
- *(str++) = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
- *(str++) = TEXT_COLOR_BLUE;
- *(str++) = TEXT_COLOR_TRANSPARENT;
- *(str++) = TEXT_COLOR_LIGHT_BLUE;
- *(str++) = CHAR_SLASH;
- *(str++) = CHAR_EXTRA_SYMBOL;
- *(str++) = CHAR_LV_2;
- str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3);
- *(str++) = CHAR_SPACE;
- *str = EOS;
-
- return str;
+ *(str++) = EXT_CTRL_CODE_SHADOW;
+ *(str++) = TEXT_COLOR_LIGHT_RED;
+ *(str++) = CHAR_MALE;
+ break;
+ case MON_FEMALE:
+ *(str++) = EXT_CTRL_CODE_BEGIN;
+ *(str++) = EXT_CTRL_CODE_COLOR;
+ *(str++) = TEXT_COLOR_GREEN;
+ *(str++) = EXT_CTRL_CODE_BEGIN;
+ *(str++) = EXT_CTRL_CODE_SHADOW;
+ *(str++) = TEXT_COLOR_LIGHT_GREEN;
+ *(str++) = CHAR_FEMALE;
+ break;
}
+
+ *(str++) = EXT_CTRL_CODE_BEGIN;
+ *(str++) = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
+ *(str++) = TEXT_COLOR_BLUE;
+ *(str++) = TEXT_COLOR_TRANSPARENT;
+ *(str++) = TEXT_COLOR_LIGHT_BLUE;
+ *(str++) = CHAR_SLASH;
+ *(str++) = CHAR_EXTRA_SYMBOL;
+ *(str++) = CHAR_LV_2;
+ str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3);
+ *(str++) = CHAR_SPACE;
+ *str = EOS;
+
+ return str;
}
// Buffers the string in src to dest up to n chars. If src is less than n chars, fill with spaces
@@ -983,6 +976,8 @@ static u8 *BufferConditionMenuSpacedStringN(u8 *dst, const u8 *src, s16 n)
void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel)
{
u16 i;
+ u16 box = boxId;
+ u16 mon = monId;
// In this and the below 2 functions, numMons is passed as the number of menu selections (which includes Cancel)
// To indicate that the Cancel needs to be subtracted they pass an additional bool
@@ -992,21 +987,16 @@ void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId
if (partyId != numMons)
{
- GetConditionMenuMonString(nameDst, boxId, monId);
+ GetConditionMenuMonString(nameDst, box, mon);
locationDst[0] = EXT_CTRL_CODE_BEGIN;
locationDst[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
locationDst[2] = TEXT_COLOR_BLUE;
locationDst[3] = TEXT_COLOR_TRANSPARENT;
locationDst[4] = TEXT_COLOR_LIGHT_BLUE;
- if (boxId == TOTAL_BOXES_COUNT) // Party mon.
- {
+ if (box == TOTAL_BOXES_COUNT) // Party mon.
BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, 8);
- }
else
- {
- boxId++;boxId--; // Again...Someone fix this maybe?
- BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(boxId), 8);
- }
+ BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(box), 8);
}
else
{