Files
pmd-sky/include/main_0200EEE0.h
cecilarmitais 3c5de72d23 Decomp IsItemWithFlagsInBag and GetItemIndex
Decompile from asm:

  IsItemWithFlagsInBag  0x0200EF20
  GetItemIndex          0x0200F14C

IsItemWithFlagsInBag matches an item by id and then by any of a flag mask, and
returns on the first item satisfying both. The two conditions can be written as
a single && or as nested ifs; both score 0, so the target does not distinguish
them and the && form is used as the more direct reading.

GetItemIndex takes a struct item pointer rather than an id. The target compares
the walking cursor against the argument, not a field of it, so this returns the
index of a bag slot the caller already holds a pointer to, and -1 when the
pointer is not in the active inventory. The index is returned through a 16-bit
narrowing, which is why the return type is s16 rather than the s32 the loop
counter uses.

No comments are added to any pmd-sky file.

Authored by Claude (Opus 5) under human direction. Confirmed by a matching
build: build/pmdsky.us/pmdsky.us.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 16:57:10 -07:00

8 lines
140 B
C

#ifndef PMDSKY_MAIN_0200EEE0_H
#define PMDSKY_MAIN_0200EEE0_H
u32 IsItemInBag(s16 id);
u32 IsItemWithFlagsInBag(s16 id, u8 flags);
#endif