Decomp GetExclusiveItemType

This commit is contained in:
VicSevenT 2025-12-31 19:37:56 -06:00
parent 7dd5d34966
commit 1d5b73adc8
4 changed files with 16 additions and 16 deletions

View File

@ -25,7 +25,7 @@
.public CopyBitsFrom
.public CopyBitsTo
.public GetDungeonGroup
.public GetExclusiveItemOffsetEnsureValid
.public GetExclusiveItemType
.public GetItemActionName
.public GetItemBuyPrice
.public GetItemCategory

View File

@ -1874,18 +1874,3 @@ SprintfStatic__0200E808_EU: ; 0x0200E808
arm_func_end SprintfStatic__0200E808_EU
#endif
arm_func_start GetExclusiveItemType
GetExclusiveItemType: ; 0x0200E760
stmdb sp!, {r3, lr}
bl GetExclusiveItemOffsetEnsureValid
ldr r1, _0200E778 ; =ITEM_DATA_TABLE_PTRS
#ifdef EUROPE
ldr r1, [r1, #4]
#else
ldr r1, [r1]
#endif
ldrb r0, [r1, r0, lsl #2]
ldmia sp!, {r3, pc}
.align 2, 0
_0200E778: .word ITEM_DATA_TABLE_PTRS
arm_func_end GetExclusiveItemType

View File

@ -3,6 +3,7 @@
#include "util.h"
u8 GetExclusiveItemType(s16 item_id);
s16 GetExclusiveItemOffsetEnsureValid(s16 item_id);
// Checks if an item is valid given its ID.

View File

@ -1,8 +1,22 @@
#include "item_util_1.h"
#include "item.h"
struct item_data_entry_alt {
u8 type;
u16 unk2;
};
extern struct item_data_entry *ITEM_DATA_TABLE_PTRS[3];
u8 GetExclusiveItemType(s16 item_id) {
item_id = GetExclusiveItemOffsetEnsureValid(item_id);
#ifdef EUROPE
return ((struct item_data_entry_alt**) (void**)ITEM_DATA_TABLE_PTRS)[1][item_id].type;
#else
return ((struct item_data_entry_alt**) (void**)ITEM_DATA_TABLE_PTRS)[0][item_id].type;
#endif
}
s16 GetExclusiveItemOffsetEnsureValid(s16 item_id) {
if (item_id < ITEM_PRISM_RUFF || item_id >= NUM_ITEM_IDS) {
return ITEM_PLAIN_SEED;