Files
pmd-sky/include/main_0200F208.h
cecilarmitais 06c828e19b Decomp CountItemTypeInBag and GetEquippedThrowableItem
Decompile from asm:

  CountItemTypeInBag        0x0200EE88
  GetEquippedThrowableItem  0x0200F208

CountItemTypeInBag totals matching slots, adding the stack size for thrown items
and one for everything else, using IsThrownItem from item_util.c.

GetEquippedThrowableItem returns the index of the first existing slot flagged
usable by L+R, or -1. It reads item->flags through struct item_volatile. The
target loads the flags byte twice, once for each test, where a plain struct item
lets the compiler reuse the first load; item.h already carries item_volatile for
exactly this purpose and says so. The cast is written at each access, following
dungeon_ai_items.c and special_move_types.c rather than casting the cursor once,
though both spellings score 0.

Only the second flag test is left as a bare mask. The existence test goes through
an explicit bool8 because the target boolifies it -- tst, movne, moveq, tst
#0xff -- while the second test branches straight off tst, which is what a bare
mask in an if produces.

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 17:16:47 -07:00

7 lines
107 B
C

#ifndef PMDSKY_MAIN_0200F208_H
#define PMDSKY_MAIN_0200F208_H
s16 GetEquippedThrowableItem(void);
#endif