diff --git a/data/item/item_data.json b/data/item/item_data.json index ae31d321c..ea0c75854 100644 --- a/data/item/item_data.json +++ b/data/item/item_data.json @@ -23,7 +23,7 @@ true ], "order": 50, - "unkThrow1B": [ + "spawnAmountRange": [ 6, 10 ], @@ -43,7 +43,7 @@ true ], "order": 48, - "unkThrow1B": [ + "spawnAmountRange": [ 5, 8 ], @@ -63,7 +63,7 @@ true ], "order": 49, - "unkThrow1B": [ + "spawnAmountRange": [ 5, 8 ], @@ -83,7 +83,7 @@ true ], "order": 47, - "unkThrow1B": [ + "spawnAmountRange": [ 5, 5 ], @@ -103,7 +103,7 @@ true ], "order": 45, - "unkThrow1B": [ + "spawnAmountRange": [ 5, 5 ], @@ -123,7 +123,7 @@ true ], "order": 46, - "unkThrow1B": [ + "spawnAmountRange": [ 5, 5 ], @@ -143,7 +143,7 @@ true ], "order": 52, - "unkThrow1B": [ + "spawnAmountRange": [ 3, 5 ], @@ -163,7 +163,7 @@ true ], "order": 51, - "unkThrow1B": [ + "spawnAmountRange": [ 7, 10 ], diff --git a/include/item.h b/include/item.h index 4399e7925..ac62267c3 100644 --- a/include/item.h +++ b/include/item.h @@ -19,7 +19,7 @@ struct ItemDataEntry /* 0x14 */ bool8 aiFlags[3]; /* 0x18 */ s16 moveID; /* 0x1A */ u8 order; // Numbered order they are in storage - /* 0x1B */ u8 unkThrow1B[2]; + /* 0x1B */ u8 spawnAmountRange[2]; /* 0x1D */ u8 palette; /* 0x1E */ u8 actionType; }; @@ -70,6 +70,9 @@ enum ItemAIFlag #define INVENTORY_SIZE 20 #define STORAGE_SIZE NUMBER_OF_ITEM_IDS +#define MIN_SPAWN_AMOUNT 0 +#define MAX_SPAWN_AMOUNT 1 + void LoadItemParameters(void); struct TeamInventory *GetMoneyItemsInfo(void); void InitializeMoneyItems(void); @@ -89,7 +92,7 @@ s32 GetItemSellPrice(u8 id); s32 GetItemOrder(u8 id); u8 GetItemPalette(u8 id); u32 GetItemActionType(u8 id); -u32 GetItemUnkThrow(u8 id, u32 r1); +u32 GetSpawnAmountRange(u8 id, u32 r1); u8 *GetItemDescription(u8 id); bool8 GetItemAIFlag(u8 id, u32 r1); void sub_8090DC4(void* param_1,u8 id, struct unkStruct_8090F58* param_3); diff --git a/src/items.c b/src/items.c index 4686c0f0a..0c55bccb7 100644 --- a/src/items.c +++ b/src/items.c @@ -37,8 +37,6 @@ extern u8 gInvalidItemIDs[0x10]; EWRAM_DATA struct OpenedFile *gItemParametersFile; EWRAM_DATA struct ItemDataEntry *gItemParametersData; -extern u8 GetItemCategory(u8); -extern u32 GetItemUnkThrow(u8, u32); extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3); extern void sub_80073B8(u32); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); @@ -115,8 +113,8 @@ void xxx_init_itemslot_8090A8C(struct Item *slot, u8 id, u8 param_3) slot->flags = ITEM_FLAG_EXISTS; slot->id = id; if (IsThrowableItem(id)) { - uVar3 = GetItemUnkThrow(id, 0); - uVar4 = GetItemUnkThrow(id, 1); + uVar3 = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT); + uVar4 = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT); slot->quantity = RandRange(uVar3, uVar4); } else if (GetItemCategory(id) == CATEGORY_POKE) @@ -143,8 +141,8 @@ void xxx_init_helditem_8090B08(struct BulkItem *held, u8 id) if (id != ITEM_NOTHING) { held->id = id; if (IsThrowableItem(id)) { - uVar2 = GetItemUnkThrow(id,0); - uVar3 = GetItemUnkThrow(id,1); + uVar2 = GetSpawnAmountRange(id,MIN_SPAWN_AMOUNT); + uVar3 = GetSpawnAmountRange(id,MAX_SPAWN_AMOUNT); held->quantity = RandRange(uVar2, uVar3); } else if (GetItemCategory(id) == CATEGORY_POKE) @@ -283,9 +281,9 @@ u32 GetItemActionType(u8 id) return gItemParametersData[id].actionType; } -u32 GetItemUnkThrow(u8 id, u32 r1) +u32 GetSpawnAmountRange(u8 id, u32 rangeIndex) { - return gItemParametersData[id].unkThrow1B[r1]; + return gItemParametersData[id].spawnAmountRange[rangeIndex]; } u8 *GetItemDescription(u8 id) diff --git a/tools/dungeonjson/dungeonjson.cpp b/tools/dungeonjson/dungeonjson.cpp index 6adb0d034..d4c64666d 100644 --- a/tools/dungeonjson/dungeonjson.cpp +++ b/tools/dungeonjson/dungeonjson.cpp @@ -673,7 +673,7 @@ string generate_item_data_text(Json data) { << "\n.byte 0" << read_json_string(data_entry["moveID"], 2) << read_json_int(data_entry["order"], 1) - << read_json_int_array(data_entry["unkThrow1B"], 1, 2) + << read_json_int_array(data_entry["spawnAmountRange"], 1, 2) << read_json_int(data_entry["paletteID"], 1) << read_json_string(data_entry["actionType"], 1) << "\n.byte 0\n";