Decomp AreItemsEquivalent

This commit is contained in:
Zur3l
2026-07-11 16:00:10 -04:00
parent 539dd92880
commit a929271ae0
5 changed files with 20 additions and 30 deletions

View File

@@ -1,36 +1,8 @@
.include "asm/macros.inc"
.include "main_0200D834.inc"
.include "main_0200D894.inc"
.text
arm_func_start AreItemsEquivalent
AreItemsEquivalent: ; 0x0200D834
ldrb ip, [r0]
ldrb r3, [r1]
and ip, ip, r2
and r2, r3, r2
cmp ip, r2
movne r0, #0
bxne lr
ldrb r3, [r0, #1]
ldrb r2, [r1, #1]
cmp r3, r2
movne r0, #0
bxne lr
ldrh r3, [r0, #2]
ldrh r2, [r1, #2]
cmp r3, r2
movne r0, #0
bxne lr
ldrsh r2, [r0, #4]
ldrsh r0, [r1, #4]
cmp r2, r0
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end AreItemsEquivalent
arm_func_start sub_0200D894
sub_0200D894: ; 0x0200D894
mov r1, #0

View File

@@ -4,5 +4,6 @@
#include "item.h"
void ItemZInit(struct item* item);
bool8 AreItemsEquivalent(struct item* item1, struct item* item2, s32 bitmask);
#endif //PMDSKY_MAIN_0200D81C_H

View File

@@ -60,7 +60,7 @@ Static main
Object src/item_util_4.o
Object asm/main_0200D1F0.o
Object src/main_0200D81C.o
Object asm/main_0200D834.o
Object asm/main_0200D894.o
Object src/item_util_1.o
Object asm/main_0200EB30.o
Object src/main_0200ECFC.o

View File

@@ -7,3 +7,20 @@ void ItemZInit(struct item* item)
item->flags = 0;
item->held_by = 0;
}
bool8 AreItemsEquivalent(struct item* item1, struct item* item2, s32 bitmask)
{
if ((item1->flags & bitmask) != (item2->flags & bitmask)) {
return FALSE;
}
if (item1->held_by != item2->held_by) {
return FALSE;
}
if (item1->quantity != item2->quantity) {
return FALSE;
}
if (item1->id != item2->id) {
return FALSE;
}
return TRUE;
}