Debug menu to give items based on max quantity and map number 3digits display (#2807)

This commit is contained in:
Eduardo Quezada D'Ottone 2023-03-09 08:17:29 -03:00 committed by GitHub
commit bb90dc7dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,7 @@ enum { //Sound
#define DEBUG_NUMBER_DIGITS_VARIABLES 5
#define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5
#define DEBUG_NUMBER_DIGITS_ITEMS 4
#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2
#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 3
#define DEBUG_NUMBER_ICON_X 210
#define DEBUG_NUMBER_ICON_Y 50
@ -1015,8 +1015,8 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId)
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[4] = 0;
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2);
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2);
ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2);
StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0);
StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
@ -1061,8 +1061,8 @@ static void DebugAction_Util_Warp_SelectMap(u8 taskId)
gTasks[taskId].data[4] += 1;
}
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2);
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2);
ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2);
StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0);
StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
@ -1905,15 +1905,18 @@ static void DebugAction_Give_Item_SelectId(u8 taskId)
}
static void DebugAction_Give_Item_SelectQuantity(u8 taskId)
{
u32 itemId = gTasks[taskId].data[5];
if (JOY_NEW(DPAD_ANY))
{
PlaySE(SE_SELECT);
if (JOY_NEW(DPAD_UP))
{
u32 maxCapacity = (ItemId_GetPocket(itemId) - 1 == BERRIES_POCKET) ? MAX_BERRY_CAPACITY : MAX_BAG_ITEM_CAPACITY;
gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
if (gTasks[taskId].data[3] >= 100)
gTasks[taskId].data[3] = 99;
if (gTasks[taskId].data[3] > maxCapacity)
gTasks[taskId].data[3] = maxCapacity;
}
if (JOY_NEW(DPAD_DOWN))
{
@ -1947,7 +1950,7 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId)
DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon
PlaySE(MUS_OBTAIN_ITEM);
AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]);
AddBagItem(itemId, gTasks[taskId].data[3]);
DebugAction_DestroyExtraWindow(taskId);
}
else if (JOY_NEW(B_BUTTON))