mirror of
https://github.com/pret/pmd-sky.git
synced 2026-04-25 07:24:42 -05:00
Decomp InitBulkItem thanks to @tgsm
This commit is contained in:
parent
1753dbd905
commit
afd76a33ac
|
|
@ -3,42 +3,6 @@
|
|||
|
||||
.text
|
||||
|
||||
arm_func_start InitBulkItem
|
||||
InitBulkItem: ; 0x0200CF78
|
||||
stmdb sp!, {r4, r5, r6, lr}
|
||||
movs r5, r1
|
||||
mov r6, r0
|
||||
strh r5, [r6]
|
||||
beq _0200CFE4
|
||||
mov r0, r5
|
||||
bl IsThrownItem
|
||||
cmp r0, #0
|
||||
mov r0, r5
|
||||
beq _0200CFC8
|
||||
mov r1, #1
|
||||
bl GetThrownItemQuantityLimit
|
||||
mov r4, r0
|
||||
mov r0, r5
|
||||
mov r1, #0
|
||||
bl GetThrownItemQuantityLimit
|
||||
mov r1, r4
|
||||
bl RandRangeSafe
|
||||
strh r0, [r6, #2]
|
||||
ldmia sp!, {r4, r5, r6, pc}
|
||||
_0200CFC8:
|
||||
bl GetItemCategory
|
||||
cmp r0, #6
|
||||
moveq r0, #1
|
||||
streqh r0, [r6, #2]
|
||||
movne r0, #0
|
||||
strneh r0, [r6, #2]
|
||||
ldmia sp!, {r4, r5, r6, pc}
|
||||
_0200CFE4:
|
||||
mov r0, #0
|
||||
strh r0, [r6, #2]
|
||||
ldmia sp!, {r4, r5, r6, pc}
|
||||
arm_func_end InitBulkItem
|
||||
|
||||
arm_func_start BulkItemToItem
|
||||
BulkItemToItem: ; 0x0200CFF0
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
|
|
|
|||
|
|
@ -1661,4 +1661,10 @@ struct item_data_entry
|
|||
/* 0xE */ u8 flags;
|
||||
};
|
||||
|
||||
struct bulk_item
|
||||
{
|
||||
/* 0x0 */ s16 id;
|
||||
/* 0x2 */ u16 quantity;
|
||||
};
|
||||
|
||||
#endif //PMDSKY_ITEM_H
|
||||
|
|
|
|||
|
|
@ -3,12 +3,6 @@
|
|||
|
||||
#include "item.h"
|
||||
|
||||
struct bulk_item
|
||||
{
|
||||
/* 0x0 */ s16 id;
|
||||
/* 0x2 */ u16 quantity;
|
||||
} BulkItem;
|
||||
|
||||
BOOL IsLosableItem(struct item* item);
|
||||
bool8 IsTreasureBox(s16 item_id);
|
||||
bool8 IsStorableItem(s16 item_id);
|
||||
|
|
@ -19,7 +13,7 @@ bool8 IsTicketItem(s16 item_id);
|
|||
void InitItem(struct item* item, s16 id, s16 quantity, bool8 isSticky);
|
||||
void InitStandardItem(struct item* item, s16 id, bool8 isSticky);
|
||||
void sub_0200CF6C(struct item* item, s16 id, s16 quantity, bool8 isSticky);
|
||||
//void InitBulkItem(struct bulk_item* item, s16 id);
|
||||
void InitBulkItem(struct bulk_item* item, s16 id);
|
||||
|
||||
#endif //PMDSKY_ITEM_UTIL_4_H
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ void InitItem(struct item* item, s16 id, s16 quantity, bool8 isSticky)
|
|||
s32 category;
|
||||
s32 to;
|
||||
|
||||
if (id != 0) {
|
||||
if (id != ITEM_NOTHING) {
|
||||
item->flags = ITEM_FLAG_EXISTS;
|
||||
item->id = id;
|
||||
item->held_by = 0;
|
||||
|
|
@ -124,7 +124,7 @@ void InitItem(struct item* item, s16 id, s16 quantity, bool8 isSticky)
|
|||
item->quantity = 0;
|
||||
}
|
||||
}
|
||||
if (isSticky != 0) {
|
||||
if (isSticky) {
|
||||
item->flags |= ITEM_FLAG_STICKY;
|
||||
}
|
||||
return;
|
||||
|
|
@ -143,3 +143,24 @@ void sub_0200CF6C(struct item* item, s16 id, s16 quantity, bool8 isSticky)
|
|||
{
|
||||
InitItem(item, id, quantity, isSticky);
|
||||
}
|
||||
|
||||
void InitBulkItem(struct bulk_item* item, s16 id) {
|
||||
s32 to;
|
||||
|
||||
item->id = id;
|
||||
if (id != ITEM_NOTHING) {
|
||||
if (IsThrownItem(id)) {
|
||||
to = GetThrownItemQuantityLimit(id, 1);
|
||||
item->quantity = RandRangeSafe(GetThrownItemQuantityLimit(id, 0), to);
|
||||
}
|
||||
else if (GetItemCategory(id) == CATEGORY_POKE) {
|
||||
item->quantity = 1;
|
||||
} else {
|
||||
item->quantity = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->quantity = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user