From a61f7ea2a1913df28ea4f3ecd71c57fa4e5bbf5c Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Wed, 29 Dec 2021 23:33:22 -0600 Subject: Decomped HasItem() --- src/dungeon_items.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/dungeon_items.c (limited to 'src/dungeon_items.c') 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; +} -- cgit v1.2.3 From c30cf5c6da8283330bc352d58acc037739cd8b72 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Tue, 4 Jan 2022 00:00:31 -0600 Subject: Decomped EvaluateItem() --- src/dungeon_items.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dungeon_items.c') diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 5614e9b..bfaab53 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -4,16 +4,16 @@ 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)) + struct DungeonEntityData *pokemonData = pokemonData = pokemon->entityData; + if (!(pokemonData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) { return FALSE; } - if (entityData->heldItem.itemFlags & ITEM_FLAG_STICKY) + if (pokemonData->heldItem.itemFlags & ITEM_FLAG_STICKY) { return FALSE; } - if (entityData->heldItem.itemIndex != itemIndex) + if (pokemonData->heldItem.itemIndex != itemIndex) { return FALSE; } -- cgit v1.2.3