diff --git a/include/constants/items.h b/include/constants/items.h index 9496a4c61e..95c6aacfea 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -497,6 +497,10 @@ #define MAX_PC_ITEM_CAPACITY 999 #define MAX_BERRY_CAPACITY 999 +#define BAG_ITEM_CAPACITY_DIGITS 2 +#define BERRY_CAPACITY_DIGITS 3 +#define MAX_ITEM_DIGITS BERRY_CAPACITY_DIGITS + // Secondary IDs for rods #define OLD_ROD 0 #define GOOD_ROD 1 diff --git a/src/item_menu.c b/src/item_menu.c index d40c3a12c7..d5e50fc2da 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -919,14 +919,14 @@ void BagMenu_ItemPrintCallback(u8 windowId, s32 itemIndex, u8 y) if (gBagPositionStruct.pocket == BERRIES_POCKET) { - ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, BERRY_CAPACITY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_xVar1); offset = GetStringRightAlignXOffset(7, gStringVar4, 119); BagMenu_Print(windowId, 7, gStringVar4, offset, y, 0, 0, -1, 0); } else if (gBagPositionStruct.pocket != KEYITEMS_POCKET && ItemId_GetImportance(itemId) == FALSE) { - ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, 2); + ConvertIntToDecimalStringN(gStringVar1, itemQuantity, STR_CONV_MODE_RIGHT_ALIGN, BAG_ITEM_CAPACITY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_xVar1); offset = GetStringRightAlignXOffset(7, gStringVar4, 119); BagMenu_Print(windowId, 7, gStringVar4, offset, y, 0, 0, -1, 0); @@ -1133,7 +1133,7 @@ void sub_81ABC3C(u8 a) void PrintItemDepositAmount(u8 windowId, s16 numDeposited) { - u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2; + u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? BERRY_CAPACITY_DIGITS : BAG_ITEM_CAPACITY_DIGITS; ConvertIntToDecimalStringN(gStringVar1, numDeposited, STR_CONV_MODE_LEADING_ZEROS, numDigits); StringExpandPlaceholders(gStringVar4, gText_xVar1); AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0); @@ -1141,7 +1141,7 @@ void PrintItemDepositAmount(u8 windowId, s16 numDeposited) void PrintItemSoldAmount(int windowId, int numSold, int moneyEarned) { - u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2; + u8 numDigits = (gBagPositionStruct.pocket == BERRIES_POCKET) ? BERRY_CAPACITY_DIGITS : BAG_ITEM_CAPACITY_DIGITS; ConvertIntToDecimalStringN(gStringVar1, numSold, STR_CONV_MODE_LEADING_ZEROS, numDigits); StringExpandPlaceholders(gStringVar4, gText_xVar1); AddTextPrinterParameterized(windowId, 1, gStringVar4, 0, 1, -1, 0); @@ -1761,7 +1761,7 @@ void BagMenu_TossItems(u8 taskId) s16* data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); FillWindowPixelBuffer(1, PIXEL_FILL(0)); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); @@ -1804,7 +1804,7 @@ void BagMenu_ConfirmToss(u8 taskId) s16* data = gTasks[taskId].data; CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); FillWindowPixelBuffer(1, PIXEL_FILL(0)); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); @@ -2172,7 +2172,7 @@ static void BagMenu_TryDepositItem(u8 taskId) else if (AddPCItem(gSpecialVar_ItemId, tItemCount) == TRUE) { CopyItemName(gSpecialVar_ItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, MAX_ITEM_DIGITS); StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s); BagMenu_Print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); gTasks[taskId].func = Task_ActuallyToss; diff --git a/src/shop.c b/src/shop.c index 6e2e82a521..44ab0885ce 100755 --- a/src/shop.c +++ b/src/shop.c @@ -984,7 +984,7 @@ static void Task_BuyHowManyDialogueInit(u8 taskId) u16 maxQuantity; DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 13); - ConvertIntToDecimalStringN(gStringVar1, quantityInBag, STR_CONV_MODE_RIGHT_ALIGN, 4); + ConvertIntToDecimalStringN(gStringVar1, quantityInBag, STR_CONV_MODE_RIGHT_ALIGN, MAX_ITEM_DIGITS + 1); StringExpandPlaceholders(gStringVar4, gText_InBagVar1); BuyMenuPrint(3, gStringVar4, 0, 1, 0, 0); tItemCount = 1; @@ -1026,7 +1026,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) ClearWindowTilemap(3); PutWindowTilemap(1); CopyItemName(tItemId, gStringVar1); - ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, 2); + ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, BAG_ITEM_CAPACITY_DIGITS); ConvertIntToDecimalStringN(gStringVar3, gShopDataPtr->totalCost, STR_CONV_MODE_LEFT_ALIGN, 6); BuyMenuDisplayMessage(taskId, gText_Var1AndYouWantedVar2, BuyMenuConfirmPurchase); } @@ -1148,7 +1148,7 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId) FillWindowPixelBuffer(4, PIXEL_FILL(1)); PrintMoneyAmount(4, 38, 1, gShopDataPtr->totalCost, TEXT_SPEED_FF); - ConvertIntToDecimalStringN(gStringVar1, tItemCount, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, tItemCount, STR_CONV_MODE_LEADING_ZEROS, BAG_ITEM_CAPACITY_DIGITS); StringExpandPlaceholders(gStringVar4, gText_xVar1); BuyMenuPrint(4, gStringVar4, 0, 1, 0, 0); }