summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCheng Hann Gan <chenghanngan.us@gmail.com>2021-11-13 19:59:20 -0500
committerGitHub <noreply@github.com>2021-11-13 16:59:20 -0800
commit0ea22237c933523f66d7468a953c5a5057b3a899 (patch)
tree07290e57a9092e6c3e5d49bf28e37b20411cf04d /include
parent561ea52847f5a88dc6a9a79dbfc5c40f421cace5 (diff)
Decomped DecideUseItem (#73)
Diffstat (limited to 'include')
-rw-r--r--include/constants/direction.h5
-rw-r--r--include/dungeon_ai_items.h9
-rw-r--r--include/dungeon_entity.h14
-rw-r--r--include/item.h9
4 files changed, 26 insertions, 11 deletions
diff --git a/include/constants/direction.h b/include/constants/direction.h
index 5f2bfb3..7c5cec5 100644
--- a/include/constants/direction.h
+++ b/include/constants/direction.h
@@ -1,6 +1,8 @@
#ifndef GUARD_CONSTANTS_DIRECTION_H
#define GUARD_CONSTANTS_DIRECTION_H
+#define DIRECTION_MASK 7
+
enum Direction
{
DIRECTION_SOUTH,
@@ -10,7 +12,8 @@ enum Direction
DIRECTION_NORTH,
DIRECTION_NORTHWEST,
DIRECTION_WEST,
- DIRECTION_SOUTHWEST
+ DIRECTION_SOUTHWEST,
+ NUM_DIRECTIONS
};
#endif
diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h
new file mode 100644
index 0000000..e7d9f4f
--- /dev/null
+++ b/include/dungeon_ai_items.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_DUNGEON_AI_ITEMS_H
+#define GUARD_DUNGEON_AI_ITEMS_H
+
+#include "dungeon_entity.h"
+
+// 0x73658
+void DecideUseItem(struct DungeonEntity *pokemon);
+
+#endif
diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h
index d89b997..341f3d6 100644
--- a/include/dungeon_entity.h
+++ b/include/dungeon_entity.h
@@ -62,17 +62,13 @@ struct DungeonEntityData
/* 0x4E */ s16 lastItemThrowPositionY;
u8 fill50[0x58 - 0x50];
// Position of the target that the Pokémon wants throw an item at.
- /* 0x58 */ s16 itemTargetPositionX;
- /* 0x5A */ s16 itemTargetPositionY;
+ /* 0x58 */ s16 *itemTargetPosition;
/* 0x5C */ u8 type1;
/* 0x5D */ u8 type2;
/* 0x5E */ u8 ability1;
/* 0x5F */ u8 ability2;
- // Same format as ItemSlot struct.
- /* 0x60 */ u8 heldItemFlags;
- /* 0x61 */ u8 heldItemNumItems;
- /* 0x62 */ u8 heldItemIndex;
- u8 fill63[0x68 - 0x63];
+ /* 0x60 */ struct ItemSlot heldItem;
+ u8 fill64[0x68 - 0x64];
/* 0x68 */ s16 previousPosition1X;
/* 0x6A */ s16 previousPosition1Y;
/* 0x6C */ s16 previousPosition2X;
@@ -282,8 +278,8 @@ enum EntityType
{
ENTITY_NONE = 0,
ENTITY_POKEMON = 1,
- ENTITY_ITEM = 2,
- ENTITY_TRAP = 3
+ ENTITY_TRAP = 2,
+ ENTITY_ITEM = 3
};
enum MovementFlag
diff --git a/include/item.h b/include/item.h
index 3b4f199..60a9014 100644
--- a/include/item.h
+++ b/include/item.h
@@ -59,6 +59,13 @@ enum ItemFlag
ITEM_FLAG_SET = 1 << 4 // This item can be thrown by pressing L+R instead of having to go to the bag menu.
};
+enum ItemAIFlag
+{
+ ITEM_AI_FLAG_TARGET_SELF,
+ ITEM_AI_FLAG_TARGET_ALLY,
+ ITEM_AI_FLAG_TARGET_ENEMY
+};
+
#define NUMBER_OF_GUMMIS 18
#define INVENTORY_SIZE 20
#define STORAGE_SIZE NUMBER_OF_ITEM_IDS
@@ -84,7 +91,7 @@ u8 GetItemPalette(u8 itemIndex);
u8 GetItemCategory(u8 itemIndex);
u32 GetItemUnkThrow(u8 itemIndex, u32 r1);
u8 *GetItemDescription(u8 itemIndex);
-u32 GetItemAIFlags(u8 itemIndex, u32 r1);
+bool8 GetItemAIFlag(u8 itemIndex, u32 r1);
void sub_8090DC4(void* param_1,u8 itemIndex, struct unkStruct_8090F58* param_3);
void sub_8090E14(u8* ext_buffer, struct ItemSlot* slot, struct unkStruct_8090F58* a3);
bool8 AddItemToInventory(const struct ItemSlot* slot);