From 1ae67805bcf7ba402ce2a73b2fbf04b26ded377b Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 2 Jan 2017 03:01:17 -0800 Subject: battle type constants --- include/battle.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 06daeb081..14cbb3a1b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -1,6 +1,22 @@ #ifndef GUARD_BATTLE_H #define GUARD_BATTLE_H +#define BATTLE_TYPE_DOUBLE 0x0001 +#define BATTLE_TYPE_LINK 0x0002 +#define BATTLE_TYPE_WILD 0x0004 +#define BATTLE_TYPE_TRAINER 0x0008 +#define BATTLE_TYPE_FIRST_BATTLE 0x0010 +#define BATTLE_TYPE_20 0x0020 +#define BATTLE_TYPE_40 0x0040 +#define BATTLE_TYPE_SAFARI 0x0080 +#define BATTLE_TYPE_BATTLE_TOWER 0x0100 +#define BATTLE_TYPE_WALLY_TUTORIAL 0x0200 +#define BATTLE_TYPE_ROAMER 0x0400 +#define BATTLE_TYPE_EREADER_TRAINER 0x0800 +#define BATTLE_TYPE_KYOGRE_GROUDON 0x1000 +#define BATTLE_TYPE_LEGENDARY 0x2000 +#define BATTLE_TYPE_REGI 0x4000 + struct Trainer { /*0x00*/ u8 partyFlags; -- cgit v1.2.3 From 94fb9ab2a9ed111c72a80693d8f29ea4bc531898 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Thu, 5 Jan 2017 22:50:45 -0500 Subject: more labels (#165) * more labels and match sub_810745C * formatting * move BattleStruct to battle.h and combine both loose structs * oops * more labels for rom4.c --- include/battle.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 14cbb3a1b..2f52fd986 100644 --- a/include/battle.h +++ b/include/battle.h @@ -32,4 +32,39 @@ struct Trainer /*0x24*/ void *party; }; +struct AI_ThinkingStruct /* 0x2016800 */ +{ +/* 0x00 */ u8 unk0; +/* 0x01 */ u8 moveConsidered; +/* 0x02 */ u16 unk2; +/* 0x04 */ s8 score[4]; // score? +/* 0x08 */ u32 unk8; +/* 0x0C */ u32 aiFlags; +/* 0x10 */ u8 unk10; +/* 0x11 */ u8 aiLogicId; +/* 0x12 */ u8 filler12[6]; +/* 0x18 */ u8 unk18[4]; +}; + +struct SmallBattleStruct1 +{ + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; +}; + +struct BattleStruct /* 0x2000000 */ +{ + u8 filler0[0x1601C]; + struct SmallBattleStruct1 unk; + u8 filler1[0xAB]; // 0x2016020 + /* 0x160CB */ u8 linkPlayerIndex; + u8 filler2[0x734]; + struct AI_ThinkingStruct ai; +}; + +extern struct BattleStruct unk_2000000; +extern struct AI_ThinkingStruct gAIThinkingSpace; + #endif // GUARD_BATTLE_H -- cgit v1.2.3 From dc2d1251f1453049b9caadb5bb955083a7e54028 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 6 Jan 2017 04:13:59 +0000 Subject: quick fix to make ROM build again --- include/battle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 2f52fd986..d58b234e3 100644 --- a/include/battle.h +++ b/include/battle.h @@ -64,7 +64,7 @@ struct BattleStruct /* 0x2000000 */ struct AI_ThinkingStruct ai; }; -extern struct BattleStruct unk_2000000; +extern struct BattleStruct battle_2000000; extern struct AI_ThinkingStruct gAIThinkingSpace; #endif // GUARD_BATTLE_H -- cgit v1.2.3 From f88eeb607409528dadbf841f2cb8e805d6e86deb Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Tue, 10 Jan 2017 23:17:43 -0500 Subject: more labels and finish decompiling battle_ai.c except for unk_24 (#184) * labels for save_menu_util.c * formatting, i suck at it * fix sub_80712B4 to not use MyTask struct * pls don't kill me * current changes * decompile BattleAICmd_if_damage_bonus * formatting * label thinking struct unk8 * decompile BattleAICMd_if_status_not_in_party * decompile more battle_ai.c functions * Began decompilation of a random file * decompile BattleAICmd_if_can_faint and BattleAICmd_if_cant_faint * decompile unk_3F and unk_40 * decompile if_move_effect and if_not_move_effect * formatting, silly * decompile if_last_move_did_damage and if_encored * decompile unk_45 if_random_2 and unk_47 * decompile get_hold_effect and get_gender * decompile is_first_turn and get_stockpile_count * decompile unk_4C and get_item * decompile unk_4E unk_4F and unk_50 * decompile get_protect_count and the remaining stub macros * decompile call jump and unk_5A * decompile if_level_cond * decompile the last AI macros besides unk_24 * finish decompiling battle_ai.c except for unk_24 --- include/battle.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index d58b234e3..4f1bc70e1 100644 --- a/include/battle.h +++ b/include/battle.h @@ -38,7 +38,7 @@ struct AI_ThinkingStruct /* 0x2016800 */ /* 0x01 */ u8 moveConsidered; /* 0x02 */ u16 unk2; /* 0x04 */ s8 score[4]; // score? -/* 0x08 */ u32 unk8; +/* 0x08 */ u32 funcResult; /* 0x0C */ u32 aiFlags; /* 0x10 */ u8 unk10; /* 0x11 */ u8 aiLogicId; @@ -54,14 +54,22 @@ struct SmallBattleStruct1 u8 unk4; }; +struct SmallItemStruct +{ + u8 item[2][2]; +}; + struct BattleStruct /* 0x2000000 */ { u8 filler0[0x1601C]; struct SmallBattleStruct1 unk; - u8 filler1[0xAB]; // 0x2016020 + u8 filler1[0x68]; // 0x2016020 + u8 unk88; + u8 filler1_2[0x42]; /* 0x160CB */ u8 linkPlayerIndex; - u8 filler2[0x734]; - struct AI_ThinkingStruct ai; + struct SmallItemStruct item; + u8 filler2[0x730]; + struct AI_ThinkingStruct ai; /* 0x2016800 */ }; extern struct BattleStruct battle_2000000; -- cgit v1.2.3 From ed8f49d5e1418309cbc4f705a242d073258c8639 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 28 Jan 2017 13:51:14 -0800 Subject: tabs to spaces --- include/battle.h | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 4f1bc70e1..82ed5f29c 100644 --- a/include/battle.h +++ b/include/battle.h @@ -19,17 +19,17 @@ struct Trainer { - /*0x00*/ u8 partyFlags; - /*0x01*/ u8 trainerClass; - /*0x02*/ u8 encounterMusic:7; - /*0x02*/ u8 gender:1; - /*0x03*/ u8 trainerPic; - /*0x04*/ u8 trainerName[12]; - /*0x10*/ u16 items[4]; - /*0x18*/ bool8 doubleBattle; - /*0x1C*/ u32 aiFlags; - /*0x20*/ u8 partySize; - /*0x24*/ void *party; + /*0x00*/ u8 partyFlags; + /*0x01*/ u8 trainerClass; + /*0x02*/ u8 encounterMusic:7; + /*0x02*/ u8 gender:1; + /*0x03*/ u8 trainerPic; + /*0x04*/ u8 trainerName[12]; + /*0x10*/ u16 items[4]; + /*0x18*/ bool8 doubleBattle; + /*0x1C*/ u32 aiFlags; + /*0x20*/ u8 partySize; + /*0x24*/ void *party; }; struct AI_ThinkingStruct /* 0x2016800 */ @@ -48,28 +48,28 @@ struct AI_ThinkingStruct /* 0x2016800 */ struct SmallBattleStruct1 { - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; }; struct SmallItemStruct { - u8 item[2][2]; + u8 item[2][2]; }; struct BattleStruct /* 0x2000000 */ { - u8 filler0[0x1601C]; - struct SmallBattleStruct1 unk; - u8 filler1[0x68]; // 0x2016020 - u8 unk88; - u8 filler1_2[0x42]; - /* 0x160CB */ u8 linkPlayerIndex; - struct SmallItemStruct item; - u8 filler2[0x730]; - struct AI_ThinkingStruct ai; /* 0x2016800 */ + u8 filler0[0x1601C]; + struct SmallBattleStruct1 unk; + u8 filler1[0x68]; // 0x2016020 + u8 unk88; + u8 filler1_2[0x42]; + /* 0x160CB */ u8 linkPlayerIndex; + struct SmallItemStruct item; + u8 filler2[0x730]; + struct AI_ThinkingStruct ai; /* 0x2016800 */ }; extern struct BattleStruct battle_2000000; -- cgit v1.2.3 From c22eb152ced1fe3bc8f9f0342a47d429bfa4c5a0 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Thu, 2 Feb 2017 00:50:47 -0500 Subject: label, document, reorganize, and clean up battle_ai.c (#228) label, document, reorganize, and clean up battle_ai.c --- include/battle.h | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 82ed5f29c..be5b5f2d2 100644 --- a/include/battle.h +++ b/include/battle.h @@ -17,6 +17,15 @@ #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_UNK5 0x0010 +#define AI_ACTION_UNK6 0x0020 +#define AI_ACTION_UNK7 0x0040 +#define AI_ACTION_UNK8 0x0080 + struct Trainer { /*0x00*/ u8 partyFlags; @@ -32,15 +41,24 @@ struct Trainer /*0x24*/ void *party; }; +struct UnknownStruct1 +{ + /*0x00*/ u16 unk0[2][8]; + /*0x20*/ u8 unk20[2]; + /*0x22*/ u8 unk22[2]; + /*0x24*/ u16 items[4]; + /*0x2C*/ u8 unk8; +}; + struct AI_ThinkingStruct /* 0x2016800 */ { -/* 0x00 */ u8 unk0; -/* 0x01 */ u8 moveConsidered; -/* 0x02 */ u16 unk2; +/* 0x00 */ u8 aiState; +/* 0x01 */ u8 movesetIndex; +/* 0x02 */ u16 moveConsidered; /* 0x04 */ s8 score[4]; // score? /* 0x08 */ u32 funcResult; /* 0x0C */ u32 aiFlags; -/* 0x10 */ u8 unk10; +/* 0x10 */ u8 aiAction; /* 0x11 */ u8 aiLogicId; /* 0x12 */ u8 filler12[6]; /* 0x18 */ u8 unk18[4]; @@ -56,7 +74,7 @@ struct SmallBattleStruct1 struct SmallItemStruct { - u8 item[2][2]; + u8 itemLocal[2][3]; }; struct BattleStruct /* 0x2000000 */ @@ -64,14 +82,17 @@ struct BattleStruct /* 0x2000000 */ u8 filler0[0x1601C]; struct SmallBattleStruct1 unk; u8 filler1[0x68]; // 0x2016020 - u8 unk88; + u8 safariFleeRate; u8 filler1_2[0x42]; /* 0x160CB */ u8 linkPlayerIndex; - struct SmallItemStruct item; - u8 filler2[0x730]; - struct AI_ThinkingStruct ai; /* 0x2016800 */ + /* 0x160CC */ struct SmallItemStruct item; + u8 filler2[0x72E]; + /* 0x16800 */ struct AI_ThinkingStruct ai; /* 0x2016800 */ + u8 filler1681C[0x1E4]; + /* 0x16A00 */ struct UnknownStruct1 unk_2016A00_2; }; +extern struct UnknownStruct1 unk_2016A00; extern struct BattleStruct battle_2000000; extern struct AI_ThinkingStruct gAIThinkingSpace; -- cgit v1.2.3 From f21587ea9eb1190ac2136d72deb7929c1e1169eb Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 11 Feb 2017 00:38:59 -0500 Subject: misc labels and memcpy/set cleanups (#232) * some labels and enumerate player speeds * clear up speed enums * GetPlayerSpeed * oops * start decompiling mauville_old_man.c * formatting * decompile more of mauville_old_man.c * someone fix this please * formatting * make ROM build again * formatting again * make ROM match again * label, document, reorganize, and clean up battle_ai.c * move stuff to battle.h and get rid of battle_2000000 * various changes * labeling * minor labels and formatting * contest ai labels and misc stuff --- include/battle.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 12 deletions(-) (limited to 'include/battle.h') 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 -- cgit v1.2.3 From 6035511c139549a0291b6b3d43b9b080f792b2b6 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 18 Mar 2017 04:00:15 +0100 Subject: reorganize and add new headers for many files --- include/battle.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index daaa78cd3..4b9144721 100644 --- a/include/battle.h +++ b/include/battle.h @@ -107,9 +107,12 @@ struct SmallItemStruct struct BattleStruct /* 0x2000000 */ { - u8 filler0[0x1601C]; + u8 filler0[0x15DDE]; + /*0x15DDE*/ u8 unk15DDE; + /*0x15DDF*/ u8 unk15DDF; + /*0x15DE0*/ u8 filler15DE0[0x23C]; // 0xAF off? struct SmallBattleStruct1 unk; - u8 filler1[0x68]; // 0x2016020 + u8 filler1[0x68]; /* 0x16089 */ u8 safariFleeRate; u8 filler1_2[0x42]; /* 0x160CB */ u8 linkPlayerIndex; -- cgit v1.2.3 From 83d695b6ace7831015d4a3572677a25eb00fdbec Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 7 May 2017 00:40:28 -0700 Subject: decompile pokemon functions --- include/battle.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 4b9144721..8f7141803 100644 --- a/include/battle.h +++ b/include/battle.h @@ -51,8 +51,7 @@ struct Trainer { /*0x00*/ u8 partyFlags; /*0x01*/ u8 trainerClass; - /*0x02*/ u8 encounterMusic:7; - /*0x02*/ u8 gender:1; + /*0x02*/ u8 encounterMusic_gender; /*0x03*/ u8 trainerPic; /*0x04*/ u8 trainerName[12]; /*0x10*/ u16 items[4]; -- cgit v1.2.3 From f546ea4f0bf95ddd4f4a07f7f83b1abc37cf57ea Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Wed, 10 May 2017 14:17:52 -0700 Subject: BATTLE_TYPE_40 -> BATTLE_TYPE_MULTI --- include/battle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 8f7141803..f05c7369d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -7,7 +7,7 @@ #define BATTLE_TYPE_TRAINER 0x0008 #define BATTLE_TYPE_FIRST_BATTLE 0x0010 #define BATTLE_TYPE_20 0x0020 -#define BATTLE_TYPE_40 0x0040 +#define BATTLE_TYPE_MULTI 0x0040 #define BATTLE_TYPE_SAFARI 0x0080 #define BATTLE_TYPE_BATTLE_TOWER 0x0100 #define BATTLE_TYPE_WALLY_TUTORIAL 0x0200 -- cgit v1.2.3 From c202c65442594b6a2a272043948c0e39d697db67 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 16 May 2017 21:09:06 -0500 Subject: more decompilation --- include/battle.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index f05c7369d..be474b59f 100644 --- a/include/battle.h +++ b/include/battle.h @@ -124,17 +124,22 @@ struct BattleStruct /* 0x2000000 */ 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]; + /*0x00*/ u8 filler0[0x3]; + /*0x04*/ u16 unk4; + /*0x06*/ u16 unk6; + /*0x08*/ u8 unk8; + /*0x09*/ u8 unk9; + /*0x0A*/ u8 unkA; + u8 fillerB[4]; + u8 unkF_0:4; + u8 unkF_4:4; + u8 filler10[3]; + /*0x13*/ u8 taunt:4; + /*0x13*/ u8 unkC:4; + /*0x14*/ u8 unk14; + /*0x15*/ u8 unk15; + /*0x16*/ u8 unk16; + /*0x17*/ u8 filler17[0x4]; }; extern struct UnknownStruct1 unk_2016A00; -- cgit v1.2.3 From 4d2b22a899c11dfcacfec6889968ab01655a3fe3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 26 May 2017 14:53:51 +0200 Subject: Add headers --- include/battle.h | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index be474b59f..57d7f1b4b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -146,4 +146,103 @@ extern struct UnknownStruct1 unk_2016A00; extern struct UnknownStruct4 gUnknown_02024CA8[]; extern struct AI_ThinkingStruct gAIThinkingSpace; +// asm/battle_1.o +void sub_800D6D4(); +void sub_800D74C(); +void sub_800D7B8(void); +void sub_800DAB8(); +void sub_800DE30(u8); +void sub_800E23C(); + +// src/battle_2.o +void sub_800E7C4(void); +void InitBattle(void); +void sub_800EC9C(void); +void sub_800F104(void); +void sub_800F298(void); +void sub_800F808(void); +void sub_800F838(struct Sprite *); +u8 CreateNPCTrainerParty(struct Pokemon *, u16); +void sub_800FCFC(void); +void c2_8011A1C(void); +void sub_80101B8(void); +void c2_081284E0(void); +void sub_8010278(struct Sprite *); +void sub_80102AC(struct Sprite *); +void nullsub_37(struct Sprite *); +void sub_8010320(struct Sprite *); +void sub_8010494(struct Sprite *); +void sub_801053C(struct Sprite *); +void oac_poke_ally_(struct Sprite *); +void nullsub_86(struct Sprite *); +void objc_dp11b_pingpong(struct Sprite *); +void nullsub_41(void); +void sub_8010800(void); +void sub_8010824(void); +void sub_8010874(void); +void bc_8012FAC(void); +void bc_load_battlefield(void); +void sub_8011384(void); +void bc_801333C(void); +void bc_battle_begin_message(void); +void bc_8013568(void); +void sub_8011800(void); +void sub_8011834(void); +void bc_801362C(void); +void sub_8011970(void); +void sub_80119B4(void); +void sub_8011B00(void); +void sub_8011E8C(void); + +// asm/battle_2.o +void sub_8012324(void); +void sub_8012FBC(u8, u8); +u8 b_first_side(u8, u8, u8); +void sub_801365C(u8); +void sub_801377C(void); +void sub_80138F0(void); +void dp01_battle_side_mark_buffer_for_execution(); +void sub_80155A4(); +void b_cancel_multi_turn_move_maybe(u8); +void b_std_message(); +void sub_80156DC(); +void sub_80157C4(u8 index); + +// asm/battle_3.o +u8 sub_8015A98(u8, u8, u8); +u8 sub_8015DFC(); +u8 sub_8016558(); +u8 sub_80170DC(); +u8 sub_80173A4(); +u8 sub_8018324(u8, u8, u8, u8, u16); +u8 sub_801A02C(); + +// asm/battle_4.o +void sub_801CAF8(u8, u8); +void move_effectiveness_something(u16, u8, u8); + +// asm/battle_5.o +void nullsub_91(void); +void sub_802BF74(void); +void sub_802C098(); +void c3_0802FDF4(u8); +void sub_802E3E4(u8, int); +void nullsub_8(u8); +void sub_802E414(void); + +// asm/battle_7.o +void move_anim_start_t4(); +void nullsub_9(u16); +void nullsub_10(); +void load_gfxc_health_bar(); +u8 battle_load_something(); +void sub_8031F88(); +void sub_80324F8(); +void sub_8032638(); +void sub_8032AA8(u8 index, int i); +void sub_8032AE0(void); + +// asm/battle_9.o +void sub_8037510(void); + #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 2aae7e99d52fc488e75309909d279b459f5e1d80 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 26 May 2017 15:35:40 +0200 Subject: Make rom build again --- include/battle.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 57d7f1b4b..4520c97ca 100644 --- a/include/battle.h +++ b/include/battle.h @@ -1,6 +1,8 @@ #ifndef GUARD_BATTLE_H #define GUARD_BATTLE_H +#include "sprite.h" + #define BATTLE_TYPE_DOUBLE 0x0001 #define BATTLE_TYPE_LINK 0x0002 #define BATTLE_TYPE_WILD 0x0004 @@ -35,7 +37,7 @@ 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 UNK_2016A00_STRUCT ((struct UnknownStruct1B *)(unk_2000000 + 0x16A00)) #define AI_STACK ((struct AI_Stack *)(unk_2000000 + 0x16C00)) #define AI_ARRAY_160CC ((struct SmallItemStruct *)(unk_2000000 + 0x160CC)) @@ -61,7 +63,7 @@ struct Trainer /*0x24*/ void *party; }; -struct UnknownStruct1 // AI_Opponent_Info? +struct UnknownStruct1B // AI_Opponent_Info? { /*0x00*/ u16 movesUsed[2][8]; // 0xFFFF means move not used (confuse self hit, etc) /*0x20*/ u8 unk20[2]; @@ -119,7 +121,7 @@ struct BattleStruct /* 0x2000000 */ u8 filler2[0x72E]; /* 0x16800 */ struct AI_ThinkingStruct ai; /* 0x2016800 */ u8 filler1681C[0x1E4]; - /* 0x16A00 */ struct UnknownStruct1 unk_2016A00_2; + /* 0x16A00 */ struct UnknownStruct1B unk_2016A00_2; }; struct UnknownStruct4 @@ -142,7 +144,7 @@ struct UnknownStruct4 /*0x17*/ u8 filler17[0x4]; }; -extern struct UnknownStruct1 unk_2016A00; +extern struct UnknownStruct1B unk_2016A00; extern struct UnknownStruct4 gUnknown_02024CA8[]; extern struct AI_ThinkingStruct gAIThinkingSpace; -- cgit v1.2.3 From 43567f631bd3ccf4539a277d5b2f01a6bc0b518e Mon Sep 17 00:00:00 2001 From: scnorton Date: Tue, 30 May 2017 11:07:38 -0400 Subject: UnkBattleStruct is actually UnknownStruct11 --- include/battle.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index be474b59f..858e493f1 100644 --- a/include/battle.h +++ b/include/battle.h @@ -146,4 +146,29 @@ extern struct UnknownStruct1 unk_2016A00; extern struct UnknownStruct4 gUnknown_02024CA8[]; extern struct AI_ThinkingStruct gAIThinkingSpace; +struct UnknownStruct11 +{ + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5_0:1; + u8 unk5_1:1; + u16 unk6; + u8 unk8[10]; + u8 unk12; + u8 unk13; + u8 unk14[10]; + u8 filler1E[2]; + u16 unk20; + u16 unk22; + u16 unk24; + u16 unk26; + u16 unk28; + u8 unk2A[10]; + u8 filler34[2]; + u8 unk36[10]; +}; + #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 61101812ca750393ba24cae103cb86b40001251a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Wed, 7 Jun 2017 14:09:45 -0500 Subject: decompile sub_811FAE4 - sub_811FCE8 --- include/battle.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index be474b59f..f72333a9d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -35,7 +35,7 @@ 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 UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *)(unk_2000000 + 0x16A00)) #define AI_STACK ((struct AI_Stack *)(unk_2000000 + 0x16C00)) #define AI_ARRAY_160CC ((struct SmallItemStruct *)(unk_2000000 + 0x160CC)) @@ -61,7 +61,7 @@ struct Trainer /*0x24*/ void *party; }; -struct UnknownStruct1 // AI_Opponent_Info? +struct UnkBattleStruct1 // AI_Opponent_Info? { /*0x00*/ u16 movesUsed[2][8]; // 0xFFFF means move not used (confuse self hit, etc) /*0x20*/ u8 unk20[2]; @@ -119,7 +119,7 @@ struct BattleStruct /* 0x2000000 */ u8 filler2[0x72E]; /* 0x16800 */ struct AI_ThinkingStruct ai; /* 0x2016800 */ u8 filler1681C[0x1E4]; - /* 0x16A00 */ struct UnknownStruct1 unk_2016A00_2; + /* 0x16A00 */ struct UnkBattleStruct1 unk_2016A00_2; }; struct UnknownStruct4 -- cgit v1.2.3 From a6e1eb7f7522c3fef4a6c93c37c1a138524a1aa2 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Wed, 7 Jun 2017 15:23:27 -0500 Subject: decompile sub_811FF30 --- include/battle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index f72333a9d..3b4771869 100644 --- a/include/battle.h +++ b/include/battle.h @@ -122,7 +122,7 @@ struct BattleStruct /* 0x2000000 */ /* 0x16A00 */ struct UnkBattleStruct1 unk_2016A00_2; }; -struct UnknownStruct4 +struct UnkBattleStruct4 { /*0x00*/ u8 filler0[0x3]; /*0x04*/ u16 unk4; @@ -143,7 +143,7 @@ struct UnknownStruct4 }; extern struct UnknownStruct1 unk_2016A00; -extern struct UnknownStruct4 gUnknown_02024CA8[]; +extern struct UnkBattleStruct4 gUnknown_02024CA8[]; extern struct AI_ThinkingStruct gAIThinkingSpace; #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 16db220259f321860e503282db86837124f3c66a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 10 Jun 2017 12:56:59 -0500 Subject: move some common battle struct definitions to battle.h --- include/battle.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 10 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 3b4771869..e3ec0780e 100644 --- a/include/battle.h +++ b/include/battle.h @@ -29,16 +29,6 @@ #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 UnkBattleStruct1 *)(unk_2000000 + 0x16A00)) -#define AI_STACK ((struct AI_Stack *)(unk_2000000 + 0x16C00)) -#define AI_ARRAY_160CC ((struct SmallItemStruct *)(unk_2000000 + 0x160CC)) - enum { WEATHER_SUN, @@ -142,8 +132,59 @@ struct UnkBattleStruct4 /*0x17*/ u8 filler17[0x4]; }; +struct Struct2017800 +{ + u8 unk0_0:1; + u8 unk0_1:1; + u8 unk0_2:1; + u8 unk0_3:1; + u8 unk0_4:1; + u16 unk2; +}; + +struct Struct2017810 +{ + u8 unk0_0:1; + u8 unk0_1:1; + u8 unk0_2:1; + u8 unk0_3:1; + u8 unk0_4:1; + u8 unk0_5:1; + u8 unk0_6:1; + u8 unk0_7:1; + u8 unk1_0:1; + u8 unk2; + u8 unk3; + //u8 filler2[2]; + u8 unk4; + u8 unk5; + u8 filler6[2]; + u8 unk8; + u8 unk9; + u8 fillerA[2]; +}; + +struct Struct2017840 +{ + u16 unk0; + u8 filler2[7]; + u8 unk9; +}; + extern struct UnknownStruct1 unk_2016A00; extern struct UnkBattleStruct4 gUnknown_02024CA8[]; extern struct AI_ThinkingStruct gAIThinkingSpace; +// TODO: move ewram to global.h +extern u8 ewram[]; + +#define BATTLE_STRUCT ((struct BattleStruct *) (ewram + 0x00000)) +#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(ewram + 0x16800)) +#define UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *) (ewram + 0x16A00)) +#define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00)) +#define AI_ARRAY_160CC ((struct SmallItemStruct *) (ewram + 0x160CC)) +#define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800)) +#define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810)) +#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840)) + #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 974e4da9c9d325491df07d842da5eb6b45b50b2e Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 10 Jun 2017 16:50:56 -0500 Subject: decompile sub_8032350 - sub_80326EC --- include/battle.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index e3ec0780e..5a054acc7 100644 --- a/include/battle.h +++ b/include/battle.h @@ -158,7 +158,8 @@ struct Struct2017810 //u8 filler2[2]; u8 unk4; u8 unk5; - u8 filler6[2]; + u8 unk6; + u8 unk7; u8 unk8; u8 unk9; u8 fillerA[2]; -- cgit v1.2.3 From f14f219929ec0390e385cb9eee9f10fda4baf73a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 10 Jun 2017 20:53:06 -0500 Subject: finish decompiling battle_7 --- include/battle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 5a054acc7..ec406d2e6 100644 --- a/include/battle.h +++ b/include/battle.h @@ -169,7 +169,7 @@ struct Struct2017840 { u16 unk0; u8 filler2[7]; - u8 unk9; + u8 unk9_0:1; }; extern struct UnknownStruct1 unk_2016A00; -- cgit v1.2.3 From 2f437b0a94dd88cd78d0f6b4d92b9f5169531376 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Mon, 12 Jun 2017 19:34:01 -0500 Subject: Struct30042E0 --- include/battle.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index ec406d2e6..cfac2b44b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -132,6 +132,31 @@ struct UnkBattleStruct4 /*0x17*/ u8 filler17[0x4]; }; +struct Struct30042E0 +{ + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5_0:1; + u8 unk5_1:1; + u16 unk6; + u8 unk8[10]; + u8 unk12; + u8 unk13; + u8 unk14[10]; + u8 filler1E[2]; + u16 unk20; + u16 unk22; + u16 unk24; + u16 unk26; + u16 unk28; + u8 unk2A[10]; + u8 filler34[2]; + u8 unk36[10]; +}; + struct Struct2017800 { u8 unk0_0:1; -- cgit v1.2.3 From ed372b11baf8f09ff5a305b697a859b8c5b7b3f1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 13 Jun 2017 22:20:21 -0400 Subject: Fix leading whitespace; remove unnecessary data struct macros --- include/battle.h | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 858e493f1..3eeb23f9b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -107,9 +107,9 @@ struct SmallItemStruct struct BattleStruct /* 0x2000000 */ { u8 filler0[0x15DDE]; - /*0x15DDE*/ u8 unk15DDE; - /*0x15DDF*/ u8 unk15DDF; - /*0x15DE0*/ u8 filler15DE0[0x23C]; // 0xAF off? + /*0x15DDE*/ u8 unk15DDE; + /*0x15DDF*/ u8 unk15DDF; + /*0x15DE0*/ u8 filler15DE0[0x23C]; // 0xAF off? struct SmallBattleStruct1 unk; u8 filler1[0x68]; /* 0x16089 */ u8 safariFleeRate; @@ -148,27 +148,27 @@ extern struct AI_ThinkingStruct gAIThinkingSpace; struct UnknownStruct11 { - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 unk5_0:1; - u8 unk5_1:1; - u16 unk6; - u8 unk8[10]; - u8 unk12; - u8 unk13; - u8 unk14[10]; - u8 filler1E[2]; - u16 unk20; - u16 unk22; - u16 unk24; - u16 unk26; - u16 unk28; - u8 unk2A[10]; - u8 filler34[2]; - u8 unk36[10]; + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5_0:1; + u8 unk5_1:1; + u16 unk6; + u8 unk8[10]; + u8 unk12; + u8 unk13; + u8 unk14[10]; + u8 filler1E[2]; + u16 unk20; + u16 unk22; + u16 unk24; + u16 unk26; + u16 unk28; + u8 unk2A[10]; + u8 filler34[2]; + u8 unk36[10]; }; #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 102f5b1e15e7295e30a3cebfbbad3c8af4cc1d37 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 20 Jun 2017 05:46:48 +0200 Subject: Battle labels named (#333) * Changed battle labels --- include/battle.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 255813ca3..395cf042a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -203,7 +203,7 @@ struct Struct2017840 }; extern struct UnkBattleStruct1 unk_2016A00; -extern struct UnkBattleStruct4 gUnknown_02024CA8[]; +extern struct UnkBattleStruct4 gDisableStructs[]; extern struct AI_ThinkingStruct gAIThinkingSpace; // TODO: move ewram to global.h @@ -263,30 +263,30 @@ void sub_8011834(void); void bc_801362C(void); void sub_8011970(void); void sub_80119B4(void); -void sub_8011B00(void); -void sub_8011E8C(void); +void BattleBeginFirstTurn(void); +void BattleTurnPassed(void); // asm/battle_2.o void sub_8012324(void); void sub_8012FBC(u8, u8); u8 b_first_side(u8, u8, u8); -void sub_801365C(u8); -void sub_801377C(void); +void TurnValuesCleanUp(u8); +void SpecialStatusesClear(void); void sub_80138F0(void); -void dp01_battle_side_mark_buffer_for_execution(); +void MarkBufferBankForExecution(); void sub_80155A4(); -void b_cancel_multi_turn_move_maybe(u8); -void b_std_message(); +void CancelMultiTurnMoves(u8); +void PrepareStringBattle(); void sub_80156DC(); void sub_80157C4(u8 index); // asm/battle_3.o u8 sub_8015A98(u8, u8, u8); -u8 sub_8015DFC(); -u8 sub_8016558(); +u8 UpdateTurnCounters(); +u8 TurnBasedEffects(); u8 sub_80170DC(); u8 sub_80173A4(); -u8 sub_8018324(u8, u8, u8, u8, u16); +u8 AbilityBattleEffects(u8, u8, u8, u8, u16); u8 sub_801A02C(); // asm/battle_4.o @@ -295,7 +295,7 @@ void move_effectiveness_something(u16, u8, u8); // asm/battle_5.o void nullsub_91(void); -void sub_802BF74(void); +void SetBankFuncToPlayerBufferRunCommand(void); void sub_802C098(); void c3_0802FDF4(u8); void sub_802E3E4(u8, int); @@ -312,9 +312,9 @@ void sub_8031F88(u8); void sub_80324F8(struct Pokemon *, u8); void sub_8032638(); void sub_8032AA8(u8, u8); -void sub_8032AE0(void); +void SetBankFuncToOpponentBufferRunCommand(void); // asm/battle_9.o -void sub_8037510(void); +void SetBankFuncToLinkOpponentBufferRunCommand(void); #endif // GUARD_BATTLE_H -- cgit v1.2.3 From 6046f214e335e124200441f27f5fa0b3eae6cc76 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 20 Jun 2017 19:20:11 -0500 Subject: decompile sub_8030A3C - PlayerHandleLinkStandbyMsg --- include/battle.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index 395cf042a..a02842ede 100644 --- a/include/battle.h +++ b/include/battle.h @@ -185,7 +185,6 @@ struct Struct2017810 u8 unk1_0:1; u8 unk2; u8 unk3; - //u8 filler2[2]; u8 unk4; u8 unk5; u8 unk6; @@ -202,9 +201,16 @@ struct Struct2017840 u8 unk9_0:1; }; +struct Struct20238C8 +{ + u8 unk0_0:7; + u8 unk0_7:1; +}; + extern struct UnkBattleStruct1 unk_2016A00; extern struct UnkBattleStruct4 gDisableStructs[]; extern struct AI_ThinkingStruct gAIThinkingSpace; +extern struct Struct20238C8 gUnknown_020238C8; // TODO: move ewram to global.h extern u8 ewram[]; -- cgit v1.2.3 From 7bdcf7cd6de166539897b7734b7eef7c798f7b05 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Wed, 21 Jun 2017 01:10:15 -0500 Subject: decompile sub_802F934 - PlayerHandlePrintStringPlayerOnly --- include/battle.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/battle.h') diff --git a/include/battle.h b/include/battle.h index a02842ede..d93860094 100644 --- a/include/battle.h +++ b/include/battle.h @@ -197,7 +197,8 @@ struct Struct2017810 struct Struct2017840 { u16 unk0; - u8 filler2[7]; + u8 filler2[6]; + u8 unk8; u8 unk9_0:1; }; -- cgit v1.2.3