mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-11 12:57:41 -05:00
Decomp BulkItemToItem
Thanks @SethBarberee
This commit is contained in:
@@ -1,4 +1,28 @@
|
||||
#pragma once
|
||||
.public AVAILABLE_ITEMS_IN_GROUP_TABLE
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BitstreamDebug
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public GetDungeonGroup
|
||||
.public GetExclusiveItemType
|
||||
.public GetItemActionName
|
||||
.public GetItemBuyPrice
|
||||
.public GetItemCategory
|
||||
.public GetItemName
|
||||
.public GetItemPaletteId
|
||||
.public GetItemSellPrice
|
||||
.public ITEM_TABLES_PTRS_1
|
||||
.public InitBitstreamForRead
|
||||
.public InitBitstreamForWrite
|
||||
.public InitItem
|
||||
.public IsShoppableItem
|
||||
.public IsThrownItem
|
||||
.public MONEY_QUANTITY_TABLE
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public MoneyQuantityToString__02023B30
|
||||
.public MultiplyByFixedPoint
|
||||
.public _02094D0C
|
||||
.public _02094D20
|
||||
.public _02097F34
|
||||
@@ -13,36 +37,6 @@
|
||||
.public _02097FB8
|
||||
.public _02097FC4
|
||||
.public _02097FE4
|
||||
.public _020A18BC
|
||||
.public AVAILABLE_ITEMS_IN_GROUP_TABLE
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BitstreamDebug
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public GetDungeonGroup
|
||||
.public GetExclusiveItemType
|
||||
.public GetItemActionName
|
||||
.public GetItemBuyPrice
|
||||
.public GetItemCategory
|
||||
.public GetItemMoveId
|
||||
.public GetItemName
|
||||
.public GetItemPaletteId
|
||||
.public GetItemSellPrice
|
||||
.public GetThrownItemQuantityLimit
|
||||
.public InitBitstreamForRead
|
||||
.public InitBitstreamForWrite
|
||||
.public InitItem
|
||||
.public IsAuraBow
|
||||
.public IsItemValid
|
||||
.public IsShoppableItem
|
||||
.public IsThrownItem
|
||||
.public ITEM_TABLES_PTRS_1
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public MONEY_QUANTITY_TABLE
|
||||
.public MoneyQuantityToString__02023B30
|
||||
.public MultiplyByFixedPoint
|
||||
.public RandRangeSafe
|
||||
.public strcpy
|
||||
.public strncpy
|
||||
.public sub_0200EB64
|
||||
@@ -1,61 +1,8 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0200CAFC.inc"
|
||||
.include "main_0200D0A0.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start BulkItemToItem
|
||||
BulkItemToItem: ; 0x0200CFF0
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
ldrsh r1, [r4]
|
||||
mov r5, r0
|
||||
cmp r1, #0
|
||||
beq _0200D098
|
||||
mov r0, #1
|
||||
strb r0, [r5]
|
||||
ldrsh r1, [r4]
|
||||
mov r0, #0
|
||||
strh r1, [r5, #4]
|
||||
strb r0, [r5, #1]
|
||||
ldrsh r0, [r5, #4]
|
||||
bl IsThrownItem
|
||||
cmp r0, #0
|
||||
ldrneh r0, [r4, #2]
|
||||
strneh r0, [r5, #2]
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
ldrsh r0, [r5, #4]
|
||||
bl GetItemCategory
|
||||
cmp r0, #0xe
|
||||
bgt _0200D078
|
||||
subs r1, r0, #6
|
||||
addpl pc, pc, r1, lsl #2
|
||||
b _0200D08C
|
||||
_0200D054: ; jump table
|
||||
b _0200D080 ; case 0
|
||||
b _0200D08C ; case 1
|
||||
b _0200D08C ; case 2
|
||||
b _0200D08C ; case 3
|
||||
b _0200D08C ; case 4
|
||||
b _0200D08C ; case 5
|
||||
b _0200D080 ; case 6
|
||||
b _0200D080 ; case 7
|
||||
b _0200D080 ; case 8
|
||||
_0200D078:
|
||||
cmp r0, #0xbb
|
||||
bne _0200D08C
|
||||
_0200D080:
|
||||
ldrh r0, [r4, #2]
|
||||
strh r0, [r5, #2]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
_0200D08C:
|
||||
mov r0, #0
|
||||
strh r0, [r5, #2]
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
_0200D098:
|
||||
bl ItemZInit
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end BulkItemToItem
|
||||
|
||||
arm_func_start ItemToBulkItem
|
||||
ItemToBulkItem: ; 0x0200D0A0
|
||||
ldrb r2, [r1]
|
||||
@@ -14,6 +14,7 @@ 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 BulkItemToItem(struct item* item, struct bulk_item* bulk_item);
|
||||
|
||||
#endif //PMDSKY_ITEM_UTIL_4_H
|
||||
|
||||
|
||||
2
main.lsf
2
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_0200CAFC.o
|
||||
Object asm/main_0200D0A0.o
|
||||
Object src/item_util_1.o
|
||||
Object asm/main_0200EB30.o
|
||||
Object src/main_0200ECFC.o
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
extern s16 RandRangeSafe(s32, s32);
|
||||
extern s16 _020A18BC[10];
|
||||
extern void ItemZInit();
|
||||
|
||||
BOOL IsLosableItem(struct item* item)
|
||||
{
|
||||
@@ -161,3 +162,30 @@ void InitBulkItem(struct bulk_item* item, s16 id) {
|
||||
item->quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void BulkItemToItem(struct item* item, struct bulk_item* bulk_item)
|
||||
{
|
||||
if (bulk_item->id != 0) {
|
||||
item->flags = ITEM_FLAG_EXISTS;
|
||||
item->id = bulk_item->id;
|
||||
item->held_by = 0;
|
||||
if (IsThrownItem(item->id)) {
|
||||
item->quantity = bulk_item->quantity;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(GetItemCategory(item->id)) {
|
||||
case CATEGORY_POKE:
|
||||
case CATEGORY_TREASURE_BOXES_1:
|
||||
case CATEGORY_TREASURE_BOXES_2:
|
||||
case CATEGORY_TREASURE_BOXES_3:
|
||||
case 0xBB:
|
||||
item->quantity = bulk_item->quantity;
|
||||
return;
|
||||
default:
|
||||
item->quantity = 0;
|
||||
}
|
||||
} else {
|
||||
ItemZInit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user