From 752982552e212dcb33d57c66342f87eba3ce9089 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 13:39:18 -0500 Subject: Add FIRST_BALL, some FIRST_BERRY_INDEX usage --- src/item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index 0b6366048..91d2f1a0a 100644 --- a/src/item.c +++ b/src/item.c @@ -102,8 +102,8 @@ void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) } else { - if (itemId >= ITEM_CHERI_BERRY && itemId <= ITEM_ENIGMA_BERRY) - GetBerryCountString(dst, gBerries[itemId - ITEM_CHERI_BERRY].name, quantity); + if (itemId >= FIRST_BERRY_INDEX && itemId <= LAST_BERRY_INDEX) + GetBerryCountString(dst, gBerries[itemId - FIRST_BERRY_INDEX].name, quantity); else StringCopy(dst, ItemId_GetName(itemId)); } -- cgit v1.2.3 From e6b1b97aa12ae683afbaa5b46cb27b8cdbe1448e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 12 Mar 2021 13:55:07 -0500 Subject: Nonmatching resoltuion - Fix fakematch in Cmd_get_used_held_item - Remove `static` overrides in MODERN in four objects --- src/item.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index 91d2f1a0a..892092184 100644 --- a/src/item.c +++ b/src/item.c @@ -19,9 +19,6 @@ extern u16 gUnknown_0203CF30[]; // this file's functions -#if !defined(NONMATCHING) && MODERN -#define static -#endif static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count); static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count); -- cgit v1.2.3 From 8c820878bfa91e7a00953e02a5e93847c5428468 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 22 Apr 2021 18:49:54 -0400 Subject: Document Battle Pyramid Bag --- src/item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index 892092184..b5f9e0dd6 100644 --- a/src/item.c +++ b/src/item.c @@ -820,7 +820,7 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count) u16 *items = gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode]; u8 *quantities = gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode]; - i = gPyramidBagCursorData.cursorPosition + gPyramidBagCursorData.scrollPosition; + i = gPyramidBagMenuState.cursorPosition + gPyramidBagMenuState.scrollPosition; if (items[i] == itemId && quantities[i] >= count) { quantities[i] -= count; -- cgit v1.2.3 From aad090e154d4cb1397468f3b19071ddad688a7bc Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 25 Apr 2021 17:22:45 -0400 Subject: Document TV --- src/item.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index 892092184..8259d1cd5 100644 --- a/src/item.c +++ b/src/item.c @@ -14,7 +14,6 @@ #include "battle_pyramid_bag.h" #include "constants/items.h" #include "constants/hold_effects.h" -#include "constants/tv.h" extern u16 gUnknown_0203CF30[]; -- cgit v1.2.3 From 2cc38acb8443c2c3b7da8d1e86482d25315a9880 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sun, 9 May 2021 01:27:28 -0400 Subject: fix item.c gotos --- src/item.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index cc9a09ee0..68907b02c 100644 --- a/src/item.c +++ b/src/item.c @@ -280,10 +280,6 @@ bool8 AddBagItem(u16 itemId, u16 count) { // successfully added to already existing item's count SetBagItemQuantity(&newItems[i].quantity, ownedCount + count); - - // goto SUCCESS_ADD_ITEM; - // is equivalent but won't match - memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot)); Free(newItems); return TRUE; @@ -303,7 +299,7 @@ bool8 AddBagItem(u16 itemId, u16 count) // don't create another instance of the item if it's at max slot capacity and count is equal to 0 if (count == 0) { - goto SUCCESS_ADD_ITEM; + break; } } } @@ -334,7 +330,8 @@ bool8 AddBagItem(u16 itemId, u16 count) { // created a new slot and added quantity SetBagItemQuantity(&newItems[i].quantity, count); - goto SUCCESS_ADD_ITEM; + count = 0; + break; } } } @@ -345,11 +342,9 @@ bool8 AddBagItem(u16 itemId, u16 count) return FALSE; } } - - SUCCESS_ADD_ITEM: - memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot)); - Free(newItems); - return TRUE; + memcpy(itemPocket->itemSlots, newItems, itemPocket->capacity * sizeof(struct ItemSlot)); + Free(newItems); + return TRUE; } } -- cgit v1.2.3 From 361fa594b30005edaa8aef5f6b02ac8b15149cba Mon Sep 17 00:00:00 2001 From: ExpoSeed <> Date: Sat, 15 May 2021 15:56:17 -0500 Subject: Various BUGFIXes and UBFIXes --- src/item.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/item.c') diff --git a/src/item.c b/src/item.c index 68907b02c..156034262 100644 --- a/src/item.c +++ b/src/item.c @@ -548,7 +548,6 @@ bool8 AddPCItem(u16 itemId, u16 count) void RemovePCItem(u8 index, u16 count) { - // UB: should use GetPCItemQuantity and SetPCItemQuantity functions gSaveBlock1Ptr->pcItems[index].quantity -= count; if (gSaveBlock1Ptr->pcItems[index].quantity == 0) { -- cgit v1.2.3