summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle.h67
1 files changed, 55 insertions, 12 deletions
diff --git a/include/battle.h b/include/battle.h
index be5b5f2d2..daaa78cd3 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -17,15 +17,36 @@
#define BATTLE_TYPE_LEGENDARY 0x2000
#define BATTLE_TYPE_REGI 0x4000
-#define AI_ACTION_UNK1 0x0001
-#define AI_ACTION_UNK2 0x0002
-#define AI_ACTION_UNK3 0x0004
-#define AI_ACTION_UNK4 0x0008
+#define AI_ACTION_DONE 0x0001
+#define AI_ACTION_FLEE 0x0002
+#define AI_ACTION_WATCH 0x0004
+#define AI_ACTION_DO_NOT_ATTACK 0x0008
#define AI_ACTION_UNK5 0x0010
#define AI_ACTION_UNK6 0x0020
#define AI_ACTION_UNK7 0x0040
#define AI_ACTION_UNK8 0x0080
+#define MAX_TRAINER_ITEMS 4
+#define MAX_MON_MOVES 4
+
+// needed to match the hack that is get_item, thanks cam, someone else clean this up later.
+extern u8 unk_2000000[];
+
+// to do: maybe try to reduce the defines needed to match?
+#define BATTLE_STRUCT ((struct BattleStruct *)(unk_2000000))
+#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(unk_2000000 + 0x16800))
+#define UNK_2016A00_STRUCT ((struct UnknownStruct1 *)(unk_2000000 + 0x16A00))
+#define AI_STACK ((struct AI_Stack *)(unk_2000000 + 0x16C00))
+#define AI_ARRAY_160CC ((struct SmallItemStruct *)(unk_2000000 + 0x160CC))
+
+enum
+{
+ WEATHER_SUN,
+ WEATHER_RAIN,
+ WEATHER_SANDSTORM,
+ WEATHER_HAIL,
+};
+
struct Trainer
{
/*0x00*/ u8 partyFlags;
@@ -41,13 +62,19 @@ struct Trainer
/*0x24*/ void *party;
};
-struct UnknownStruct1
+struct UnknownStruct1 // AI_Opponent_Info?
{
- /*0x00*/ u16 unk0[2][8];
+ /*0x00*/ u16 movesUsed[2][8]; // 0xFFFF means move not used (confuse self hit, etc)
/*0x20*/ u8 unk20[2];
/*0x22*/ u8 unk22[2];
/*0x24*/ u16 items[4];
- /*0x2C*/ u8 unk8;
+ /*0x2C*/ u8 numOfItems;
+};
+
+struct AI_Stack
+{
+ u8 *ptr[8];
+ u8 size;
};
struct AI_ThinkingStruct /* 0x2016800 */
@@ -61,7 +88,7 @@ struct AI_ThinkingStruct /* 0x2016800 */
/* 0x10 */ u8 aiAction;
/* 0x11 */ u8 aiLogicId;
/* 0x12 */ u8 filler12[6];
-/* 0x18 */ u8 unk18[4];
+/* 0x18 */ u8 simulatedRNG[4];
};
struct SmallBattleStruct1
@@ -70,6 +97,7 @@ struct SmallBattleStruct1
u8 unk2;
u8 unk3;
u8 unk4;
+ // unknown size
};
struct SmallItemStruct
@@ -82,18 +110,33 @@ struct BattleStruct /* 0x2000000 */
u8 filler0[0x1601C];
struct SmallBattleStruct1 unk;
u8 filler1[0x68]; // 0x2016020
- u8 safariFleeRate;
+ /* 0x16089 */ u8 safariFleeRate;
u8 filler1_2[0x42];
/* 0x160CB */ u8 linkPlayerIndex;
/* 0x160CC */ struct SmallItemStruct item;
u8 filler2[0x72E];
/* 0x16800 */ struct AI_ThinkingStruct ai; /* 0x2016800 */
- u8 filler1681C[0x1E4];
- /* 0x16A00 */ struct UnknownStruct1 unk_2016A00_2;
+ u8 filler1681C[0x1E4];
+ /* 0x16A00 */ struct UnknownStruct1 unk_2016A00_2;
+};
+
+struct UnknownStruct4
+{
+ u8 filler0[0x3];
+ u16 unk4;
+ u16 unk6;
+ u8 unk8;
+ u8 unk9;
+ u8 fillerA[0x9];
+ u8 taunt:4;
+ u8 unkC:4;
+ u8 fillerD[0x2];
+ u8 unk16;
+ u8 filler17[0x4];
};
extern struct UnknownStruct1 unk_2016A00;
-extern struct BattleStruct battle_2000000;
+extern struct UnknownStruct4 gUnknown_02024CA8[];
extern struct AI_ThinkingStruct gAIThinkingSpace;
#endif // GUARD_BATTLE_H