Merge pull request #1205 from GriffinRichards/constants-itemdigits
Use constants for item digits
This commit is contained in:
commit
00b8208914
3 changed files with 14 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue