summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCheng Hann Gan <chenghanngan.us@gmail.com>2021-10-22 13:20:01 -0400
committerGitHub <noreply@github.com>2021-10-22 10:20:01 -0700
commitc98fb2c11272680a20b9cfb9efe2ce482d3779dd (patch)
treed5001c7adfe550c52f8190934a74849920bd9eaa /include
parent3e5dd1d047bada52ab0dce2fe58b04e39bcaa1cc (diff)
Decomped DecideAction() (#66)
* Decomped DecideAction() * Defined dungeon Pokémon array sizes
Diffstat (limited to 'include')
-rw-r--r--include/constants/dungeon_action.h1
-rw-r--r--include/constants/status.h1
-rw-r--r--include/dungeon_engine.h9
-rw-r--r--include/dungeon_entity.h15
-rw-r--r--include/dungeon_global_data.h15
-rw-r--r--include/dungeon_movement.h9
-rw-r--r--include/dungeon_util.h9
7 files changed, 37 insertions, 22 deletions
diff --git a/include/constants/dungeon_action.h b/include/constants/dungeon_action.h
index f5e0290..287a1ed 100644
--- a/include/constants/dungeon_action.h
+++ b/include/constants/dungeon_action.h
@@ -3,6 +3,7 @@
enum DungeonAction
{
+ DUNGEON_ACTION_NONE = 0x0,
DUNGEON_ACTION_WAIT = 0x1,
DUNGEON_ACTION_WALK = 0x2,
// Switching between Pokémon in the moves menu.
diff --git a/include/constants/status.h b/include/constants/status.h
index 8445731..9fad5b0 100644
--- a/include/constants/status.h
+++ b/include/constants/status.h
@@ -117,6 +117,7 @@ enum VolatileStatus
enum TargetingDecoy
{
+ TARGETING_DECOY_NONE = 0,
TARGETING_DECOY_TEAM = 1,
TARGETING_DECOY_WILD = 2
};
diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h
deleted file mode 100644
index 152bda6..0000000
--- a/include/dungeon_engine.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef GUARD_DUNGEON_ENGINE_H
-#define GUARD_DUNGEON_ENGINE_H
-
-#include "dungeon_entity.h"
-
-// 0x8075990
-void decideAction(struct DungeonEntity *pokemon);
-
-#endif \ No newline at end of file
diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h
index 57ea24b..58a7d24 100644
--- a/include/dungeon_entity.h
+++ b/include/dungeon_entity.h
@@ -10,9 +10,8 @@ struct DungeonEntityData
// Pokemon: MovementFlag
// Items: ItemFlag
// Traps: TrapType
- /* 0x0 */ u8 flags;
- /* 0x1 */ bool8 moving;
- /* 0x2 */ u16 entityID; // Pokémon species or item ID.
+ /* 0x0 */ u16 flags;
+ /* 0x2 */ s16 entityID; // Pokémon species or item ID.
// Everything from here on only applies to Pokémon.
/* 0x4 */ u16 transformSpecies; // Shows a different Pokémon when using Transform.
/* 0x6 */ bool8 isEnemy;
@@ -97,7 +96,7 @@ struct DungeonEntityData
/* 0x90 */ u8 IQSkillsEnabled[4];
/* 0x94 */ u8 tactics;
u8 fill95[0xA4 - 0x95];
- /* 0xA4 */ u8 clientFlags;
+ /* 0xA4 */ u8 clientType;
u8 fillA5[0xA8 - 0xA5];
// Statuses are split into groups based on which ones can't overlap.
// See status.h for which statuses are in each group.
@@ -290,6 +289,7 @@ enum EntityType
enum MovementFlag
{
MOVEMENT_FLAG_SWAPPED_PLACES = 1 << 5,
+ MOVEMENT_FLAG_MOVING = 1 << 9,
MOVEMENT_FLAG_SWAPPED_PLACES_PETRIFIED = 1 << 15 // Set if the Pokémon is petrified and the leader cures them by swapping places.
};
@@ -312,10 +312,11 @@ enum MovementAction
MOVEMENT_ACTION_TAKE_ITEM = 7
};
-enum ClientFlag
+enum ClientType
{
- CLIENT_FLAGS_CLIENT = 1, // Used for mission clients that need rescuing.
- CLIENT_FLAGS_DONT_MOVE = 3 // Used for Diglett in the Skarmory boss fight.
+ CLIENT_TYPE_NONE = 0,
+ CLIENT_TYPE_CLIENT = 1, // Used for mission clients that need rescuing.
+ CLIENT_TYPE_DONT_MOVE = 3 // Used for Diglett in the Skarmory boss fight.
};
enum VisualFlag
diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h
index fd2aa0b..4d8883f 100644
--- a/include/dungeon_global_data.h
+++ b/include/dungeon_global_data.h
@@ -1,13 +1,16 @@
#ifndef GUARD_DUNGEON_DATA_H
#define GUARD_DUNGEON_DATA_H
-#define DUNGEON_MAX_SIZE_X 55
-#define DUNGEON_MAX_SIZE_Y 31
-
#include "constants/species.h"
#include "dungeon_entity.h"
+#include "global.h"
#include "map.h"
+#define DUNGEON_MAX_SIZE_X 55
+#define DUNGEON_MAX_SIZE_Y 31
+#define DUNGEON_MAX_WILD_POKEMON 16
+#define DUNGEON_MAX_POKEMON MAX_TEAM_MEMBERS + DUNGEON_MAX_WILD_POKEMON
+
struct DungeonGlobalData
{
u8 unk0;
@@ -73,8 +76,8 @@ struct DungeonGlobalData
u8 unk1356C;
u8 fill1356D[0x1357C - 0x1356D];
/* 0x1357C */ struct DungeonEntity *teamPokemon[MAX_TEAM_MEMBERS];
- /* 0x1358C */ struct DungeonEntity *wildPokemon[0x10];
- /* 0x135CC */ struct DungeonEntity *allPokemon[0x14]; // Contains both team and wild Pokémon
+ /* 0x1358C */ struct DungeonEntity *wildPokemon[DUNGEON_MAX_WILD_POKEMON];
+ /* 0x135CC */ struct DungeonEntity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon
/* 0x1361C */ struct DungeonEntity *clientPokemon[2]; // Not sure how large this array is.
u8 fill13624[0x181F8 - 0x13624];
/* 0x181F8 */ struct DungeonEntity *leader; // Pointer to the team leader.
@@ -86,7 +89,7 @@ struct DungeonGlobalData
/* 0x1820A */ bool8 displayBlinker; // Blacks out the screen when the player has the Blinker status.
u8 unk1820B;
u32 unk1820C;
- /* 0x18210 */ bool8 displayCrossEyed; // Displays Subsitute and flower sprites when the player has the Cross-Eyed status.
+ /* 0x18210 */ bool8 displayCrossEyed; // Displays Substitute and flower sprites when the player has the Cross-Eyed status.
u8 fill18211[0x18217 - 0x18211];
u8 unk18217;
};
diff --git a/include/dungeon_movement.h b/include/dungeon_movement.h
new file mode 100644
index 0000000..9d40a2e
--- /dev/null
+++ b/include/dungeon_movement.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_DUNGEON_MOVEMENT_H
+#define GUARD_DUNGEON_MOVEMENT_H
+
+#include "dungeon_entity.h"
+
+// 0x75990
+void DecideAction(struct DungeonEntity *pokemon);
+
+#endif \ No newline at end of file
diff --git a/include/dungeon_util.h b/include/dungeon_util.h
new file mode 100644
index 0000000..5113156
--- /dev/null
+++ b/include/dungeon_util.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_DUNGEON_UTIL_H
+#define GUARD_DUNGEON_UTIL_H
+
+#include "dungeon_entity.h"
+
+// 0x450E0
+bool8 EntityExists(struct DungeonEntity *pokemon);
+
+#endif \ No newline at end of file