diff options
author | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2021-12-29 23:33:22 -0600 |
---|---|---|
committer | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2021-12-29 23:33:22 -0600 |
commit | a61f7ea2a1913df28ea4f3ecd71c57fa4e5bbf5c (patch) | |
tree | caa6dacd9c2ac3cb94210e45eecd35af6c870747 /src | |
parent | edf909be4da55a435bf81f96ffcbd156b2120562 (diff) |
Decomped HasItem()
Diffstat (limited to 'src')
-rw-r--r-- | src/dungeon_items.c | 21 | ||||
-rw-r--r-- | src/dungeon_pokemon_attributes_1.c | 8 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/dungeon_items.c b/src/dungeon_items.c new file mode 100644 index 0000000..5614e9b --- /dev/null +++ b/src/dungeon_items.c @@ -0,0 +1,21 @@ +#include "global.h" +#include "dungeon_items.h" + +bool8 HasItem(struct DungeonEntity *pokemon, u8 itemIndex) +{ + // Weird assignment to fix a regswap. + struct DungeonEntityData *entityData = entityData = pokemon->entityData; + if (!(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) + { + return FALSE; + } + if (entityData->heldItem.itemFlags & ITEM_FLAG_STICKY) + { + return FALSE; + } + if (entityData->heldItem.itemIndex != itemIndex) + { + return FALSE; + } + return TRUE; +} diff --git a/src/dungeon_pokemon_attributes_1.c b/src/dungeon_pokemon_attributes_1.c index a5d6acf..f3829b2 100644 --- a/src/dungeon_pokemon_attributes_1.c +++ b/src/dungeon_pokemon_attributes_1.c @@ -1,19 +1,19 @@ #include "global.h" -#include "dungeon_global_data.h" #include "dungeon_pokemon_attributes_1.h" -#include "dungeon_util.h" -#include "pokemon.h" #include "constants/dungeon.h" #include "constants/iq_skill.h" #include "constants/move_id.h" #include "constants/status.h" #include "constants/tactic.h" +#include "dungeon_global_data.h" +#include "dungeon_items.h" +#include "dungeon_util.h" +#include "pokemon.h" #include "pokemon_3.h" extern s16 gItemMasterMinWildLevel; -extern u8 HasItem(struct DungeonEntity *, u32); extern bool8 IsIQSkillSet(u8 *, u32); extern void SetIQSkill(u8 *param_1, u32 skillIndex); |