diff --git a/asm/include/main_0200D0D0.inc b/asm/include/main_0200D118.inc similarity index 97% rename from asm/include/main_0200D0D0.inc rename to asm/include/main_0200D118.inc index 09eb40dc..7acf27c1 100644 --- a/asm/include/main_0200D0D0.inc +++ b/asm/include/main_0200D118.inc @@ -4,6 +4,7 @@ .public BitstreamDebug .public CopyBitsFrom .public CopyBitsTo +.public GetDisplayedBuyPrice .public GetDungeonGroup .public GetExclusiveItemType .public GetItemActionName diff --git a/asm/main_0200D0D0.s b/asm/main_0200D118.s similarity index 98% rename from asm/main_0200D0D0.s rename to asm/main_0200D118.s index b3734222..d7fd7c40 100644 --- a/asm/main_0200D0D0.s +++ b/asm/main_0200D118.s @@ -1,32 +1,8 @@ .include "asm/macros.inc" - .include "main_0200D0D0.inc" + .include "main_0200D118.inc" .text - arm_func_start GetDisplayedBuyPrice -GetDisplayedBuyPrice: ; 0x0200D0D0 - stmdb sp!, {r4, lr} - mov r4, r0 - ldrsh r1, [r4, #4] - cmp r1, #0xb7 - bne _0200D0EC - bl GetMoneyQuantity - ldmia sp!, {r4, pc} -_0200D0EC: - mov r0, r1 - bl IsThrownItem - cmp r0, #0 - ldrsh r0, [r4, #4] - beq _0200D110 - bl GetItemBuyPrice - ldrh r1, [r4, #2] - mul r0, r1, r0 - ldmia sp!, {r4, pc} -_0200D110: - bl GetItemBuyPrice - ldmia sp!, {r4, pc} - arm_func_end GetDisplayedBuyPrice - arm_func_start GetDisplayedSellPrice GetDisplayedSellPrice: ; 0x0200D118 stmdb sp!, {r4, lr} diff --git a/include/item_util_4.h b/include/item_util_4.h index 5c9a22bf..aa9aa927 100644 --- a/include/item_util_4.h +++ b/include/item_util_4.h @@ -16,6 +16,7 @@ void sub_0200CF6C(struct item* item, s16 id, s16 quantity, bool8 isSticky); void InitBulkItem(struct bulk_item* item, s16 id); void BulkItemToItem(struct item* item, struct bulk_item* bulk_item); void ItemToBulkItem(struct bulk_item* bulk, struct item* item); +s32 GetDisplayedBuyPrice(struct item* item); #endif //PMDSKY_ITEM_UTIL_4_H diff --git a/main.lsf b/main.lsf index a00ee7d8..8b87334d 100644 --- a/main.lsf +++ b/main.lsf @@ -58,7 +58,7 @@ Static main Object asm/main_0200C5B4.o Object src/item_util.o Object src/item_util_4.o - Object asm/main_0200D0D0.o + Object asm/main_0200D118.o Object src/item_util_1.o Object asm/main_0200EB30.o Object src/main_0200ECFC.o diff --git a/src/item_util_4.c b/src/item_util_4.c index 80cb582e..34374b47 100644 --- a/src/item_util_4.c +++ b/src/item_util_4.c @@ -7,6 +7,9 @@ extern s16 RandRangeSafe(s32, s32); extern s16 _020A18BC[10]; extern void ItemZInit(); +extern u16 GetItemBuyPrice(s16); +extern s32 GetMoneyQuantity(struct item*); +extern bool8 IsThrownItem(s16); BOOL IsLosableItem(struct item* item) { @@ -201,3 +204,14 @@ void ItemToBulkItem(struct bulk_item* bulk, struct item* item) bulk->quantity = 0; } } + +s32 GetDisplayedBuyPrice(struct item* item) +{ + if (item->id == ITEM_POKE) { + return GetMoneyQuantity(item); + } + if (IsThrownItem(item->id)) { + return item->quantity * GetItemBuyPrice(item->id); + } + return GetItemBuyPrice(item->id); +}