in
function
Code:
void BufferSaveMenuText(u8 textId, u8 *dest, u8 color)
you'll see this switch statement
Essentially, every "case" is one of the menu options. Here is the menu option for badges.
Code:
case SAVE_MENU_BADGES:
for (curFlag = FLAG_BADGE01_GET, flagCount = 0, endOfString = string + 1; curFlag < FLAG_BADGE01_GET + NUM_BADGES; curFlag++)
{
if (FlagGet(curFlag))
flagCount++;
}
*string = flagCount + CHAR_0;
*endOfString = EOS;
break;
"*string" is a variable that stores the actual text that's displayed. The function above it is to calculate "flagCount", which is the variable which holds the number of badges. For my purposes, I wanted the game to count how many symbols the player had acquired, so I changed the function to this:
Code:
case SAVE_MENU_BADGES:
for (curFlag = FLAG_SYS_TOWER_SILVER, flagCount = 0, endOfString = string + 1; curFlag < FLAG_SYS_TOWER_SILVER + NUM_SYMBOLS; curFlag++)
{
if (FlagGet(curFlag))
flagCount++;
}
string = ConvertIntToDecimalStringN(string, flagCount, STR_CONV_MODE_LEFT_ALIGN, 3);
*string = EOS;
break;
(NOTE: NUM_SYMBOLS was a flag I made that is counted the same way as NUM_BADGES. It won't exist in a vanilla rom. Its definition is: (1 + FLAG_SYS_PYRAMID_GOLD-FLAG_SYS_TOWER_SILVER))
However, this only affects the window that pops up when you save your game. On the title screen, there's a different function in a different location.
in
function
Code:
static void MainMenu_FormatSavegameBadges(void)
{
u8 str[0x20];
u16 badgeCount = 0;
u32 i;
for (i = FLAG_SYS_TOWER_SILVER; i < FLAG_SYS_TOWER_SILVER + NUM_SYMBOLS; i++)
{
if (FlagGet(i))
badgeCount++;
}
StringExpandPlaceholders(gStringVar4, gText_ContinueMenuBadges);
AddTextPrinterParameterized3(2, 1, 0x6C, 33, sTextColor_MenuInfo, -1, gStringVar4);
ConvertIntToDecimalStringN(str, badgeCount, STR_CONV_MODE_LEFT_ALIGN, 3);
AddTextPrinterParameterized3(2, 1, GetStringRightAlignXOffset(1, str, 0xD0), 33, sTextColor_MenuInfo, -1, str);
}
What happens is the variable "badgeCount" is calculated, then converted into a string "str", then printed. To change this to Frontier Symbols, all I did was edit the for loop to this:
Code:
for (i = FLAG_SYS_TOWER_SILVER; i < FLAG_SYS_TOWER_SILVER + NUM_SYMBOLS; i++)
{
if (FlagGet(i))
badgeCount++;
}
If you wanted to print a string here, I believe you would remove the function that converts a number to a string, then initialize and set "str" to whatever string you wanted to print.
Finally, while the number shows up correctly, the game will still label it as a "BADGE" to the player, so we need to edit a line in
find "gText_ContinueMenuBadges" and "gText_SavingBadges" and change the text to whatever you want. Here's the result (Note, I also edited the number of caught Pokemon to the number of BP in this image; if you can follow this tutorial, then making that edit yourself shouldn't be difficult at all)
Thanks for reading! Let me know if I made any mistakes.