Alchemy
Loading...
Searching...
No Matches

item_equip.h

Go to the documentation of this file.
1/// @file
2/// Colosso Log, River and Wall, and Goma Cave's entrance: giving a character an
3/// item and putting it on.
4#include "types.h"
5#include "inventory.h"
6
7/// Gives the character the item, then equip every slot of their 15 that holds
8/// it.
9UNUSED static void Scene_GiveAndEquipItem(s32 character, s32 item) {
10 struct BattleUnit *unit = UnitGet(character);
11 s32 i;
12
13 Inventory_AddItem(character, item);
14 for (i = 0; i <= 14; i++) {
15 if (unit->inventory[i] == item) {
16 Inventory_Equip(character, i);
17 }
18 }
19}
s32 Inventory_AddItem(s32 owner, s32 itemId)
Gives a unit one item, joining its first matching stack (up to 30) or taking the first free slot.
Definition inventory.c:144
s32 Inventory_Equip(s32 owner, s32 slot)
Equips the item in slot, clearing the equipped bit of the item of the same type it replaces.
Definition inventory.c:257
gOverflowItem, an item slot the spoils code uses when items are handed out.
static UNUSED void Scene_GiveAndEquipItem(s32 character, s32 item)
Gives the character the item, then equip every slot of their 15 that holds it.
Definition item_equip.h:9
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
#define UNUSED
Definition types.h:22
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
Definition units.c:73