summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/battle_setup.s2
-rw-r--r--baserom.ipsbin643126 -> 642902 bytes
-rw-r--r--data/data_8471F00.s8
-rw-r--r--data/mystery_event_msg.s2
-rw-r--r--include/unk_8159F40.h2
-rw-r--r--ld_script.txt3
-rw-r--r--src/teachy_tv.c2
-rw-r--r--src/unk_8159F40.c129
8 files changed, 126 insertions, 22 deletions
diff --git a/asm/battle_setup.s b/asm/battle_setup.s
index 54f374c78..e8e0071db 100644
--- a/asm/battle_setup.s
+++ b/asm/battle_setup.s
@@ -595,7 +595,7 @@ sub_807FB08: @ 807FB08
ldr r0, _0807FB3C @ =sub_807FAF8
str r0, [r1, 0x8]
bl SavePlayerParty
- bl sub_8159F40
+ bl InitPokedudePartyAndOpponent
bl GetWildBattleTransition
lsls r0, 24
lsrs r0, 24
diff --git a/baserom.ips b/baserom.ips
index bdd4e4f31..6119546ad 100644
--- a/baserom.ips
+++ b/baserom.ips
Binary files differ
diff --git a/data/data_8471F00.s b/data/data_8471F00.s
index 364b5458d..bd77774a9 100644
--- a/data/data_8471F00.s
+++ b/data/data_8471F00.s
@@ -1,9 +1,12 @@
#include "constants/species.h"
#include "constants/items.h"
#include "constants/moves.h"
+#include "constants/pokemon.h"
#include "constants/easy_chat.h"
#include "constants/facility_trainer_classes.h"
+#define MALE 0
+#define FEMALE 1
#define NULL 0
.include "asm/macros.inc"
@@ -210,10 +213,7 @@ gUnknown_84791CC:: @ 84791CC
.incbin "baserom.gba", 0x4791CC, 0x1C
gUnknown_84791E8:: @ 84791E8
- .incbin "baserom.gba", 0x4791E8, 0xE8
-
-gUnknown_84792D0:: @ 84792D0
- .incbin "baserom.gba", 0x4792D0, 0x10
+ .incbin "baserom.gba", 0x4791E8, 0x18
.section .rodata.8479668
diff --git a/data/mystery_event_msg.s b/data/mystery_event_msg.s
index 1a2a3587a..a62ebb8b8 100644
--- a/data/mystery_event_msg.s
+++ b/data/mystery_event_msg.s
@@ -1,3 +1,5 @@
+@ These are event scripts. They should not be moved to C.
+
#include "constants/flags.h"
#include "constants/moves.h"
#include "constants/songs.h"
diff --git a/include/unk_8159F40.h b/include/unk_8159F40.h
index 7f6a98c3a..41db36aad 100644
--- a/include/unk_8159F40.h
+++ b/include/unk_8159F40.h
@@ -3,7 +3,7 @@
#include "global.h"
-void sub_8159F40(void);
+void InitPokedudePartyAndOpponent(void);
void sub_815A008(struct QuestLog *);
void sub_815A1F8(struct QuestLog *, struct MapObjectTemplate *);
diff --git a/ld_script.txt b/ld_script.txt
index da4f6fe01..9d067f80b 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -512,6 +512,7 @@ SECTIONS {
src/text_window_graphics.o(.rodata);
src/quest_log_8150454.o(.rodata);
data/data_8471F00.o(.rodata);
+ src/unk_8159F40.o(.rodata);
src/teachy_tv.o(.rodata);
src/unk_815C980.o(.rodata);
data/data_8471F00.o(.rodata.8479668);
@@ -522,6 +523,8 @@ SECTIONS {
src/unk_815F138.o(.rodata);
src/berry_fix_program.o(.rodata);
data/data_8471F00.o(.rodata.after_trainer_tower);
+
+ /* These should not be moved to C files */
src/mystery_event_msg.o(.rodata);
data/mystery_event_msg.o(.rodata);
src/m4a_tables.o(.rodata);
diff --git a/src/teachy_tv.c b/src/teachy_tv.c
index aa273073b..c1d6dc6c8 100644
--- a/src/teachy_tv.c
+++ b/src/teachy_tv.c
@@ -1192,7 +1192,7 @@ static void TeachyTvPrepBattle(u8 taskId)
gSpecialVar_0x8004 = sStaticResources.whichScript;
gMain.savedCallback = TeachyTvRestorePlayerPartyCallback;
SavePlayerParty();
- sub_8159F40();
+ InitPokedudePartyAndOpponent();
PlayMapChosenOrBattleBGM(MUS_DUMMY);
if (sStaticResources.whichScript == TTVSCR_BATTLE)
data[6] = 9;
diff --git a/src/unk_8159F40.c b/src/unk_8159F40.c
index ab27cea63..b6881f292 100644
--- a/src/unk_8159F40.c
+++ b/src/unk_8159F40.c
@@ -7,36 +7,133 @@
#include "metatile_behavior.h"
#include "link.h"
#include "link_rfu.h"
+#include "constants/species.h"
+#include "constants/moves.h"
+#include "constants/pokemon.h"
-struct UnkStruct_84792D0
+struct PokedudeBattlePartyInfo
{
- u8 field_0;
- u8 field_1;
- u16 field_2;
- u16 field_4[4];
- u8 field_C;
- u8 field_D;
+ u8 side;
+ u8 level;
+ u16 species;
+ u16 moves[4];
+ u8 nature;
+ u8 gender;
+};
+
+static const struct PokedudeBattlePartyInfo sParties_Battle[] = {
+ {
+ .side = 0,
+ .level = 15,
+ .species = SPECIES_RATTATA,
+ .moves = {MOVE_TACKLE, MOVE_TAIL_WHIP, MOVE_HYPER_FANG, MOVE_QUICK_ATTACK},
+ .nature = NATURE_LONELY,
+ .gender = MALE
+ },
+ {
+ .side = 1,
+ .level = 18,
+ .species = SPECIES_PIDGEY,
+ .moves = {MOVE_TACKLE, MOVE_SAND_ATTACK, MOVE_GUST, MOVE_QUICK_ATTACK},
+ .nature = NATURE_NAUGHTY,
+ .gender = MALE
+ },
+ {0xFF}
+};
+
+static const struct PokedudeBattlePartyInfo sParties_Status[] = {
+ {
+ .side = 0,
+ .level = 15,
+ .species = SPECIES_RATTATA,
+ .moves = {MOVE_TACKLE, MOVE_TAIL_WHIP, MOVE_HYPER_FANG, MOVE_QUICK_ATTACK},
+ .nature = NATURE_LONELY,
+ .gender = MALE
+ },
+ {
+ .side = 1,
+ .level = 14,
+ .species = SPECIES_ODDISH,
+ .moves = {MOVE_ABSORB, MOVE_SWEET_SCENT, MOVE_POISON_POWDER},
+ .nature = NATURE_RASH,
+ .gender = MALE
+ },
+ {0xFF}
+};
+
+static const struct PokedudeBattlePartyInfo sParties_Matchups[] = {
+ {
+ .side = 0,
+ .level = 15,
+ .species = SPECIES_POLIWAG,
+ .moves = {MOVE_WATER_GUN, MOVE_HYPNOSIS, MOVE_BUBBLE},
+ .nature = NATURE_RASH,
+ .gender = MALE
+ },
+ {
+ .side = 0,
+ .level = 15,
+ .species = SPECIES_BUTTERFREE,
+ .moves = {MOVE_CONFUSION, MOVE_POISON_POWDER, MOVE_STUN_SPORE, MOVE_SLEEP_POWDER},
+ .nature = NATURE_RASH,
+ .gender = MALE
+ },
+ {
+ .side = 1,
+ .level = 14,
+ .species = SPECIES_ODDISH,
+ .moves = {MOVE_ABSORB, MOVE_SWEET_SCENT, MOVE_POISON_POWDER},
+ .nature = NATURE_RASH,
+ .gender = MALE
+ },
+ {0xFF}
+};
+
+static const struct PokedudeBattlePartyInfo sParties_Catching[] = {
+ {
+ .side = 0,
+ .level = 15,
+ .species = SPECIES_BUTTERFREE,
+ .moves = {MOVE_CONFUSION, MOVE_POISON_POWDER, MOVE_SLEEP_POWDER, MOVE_STUN_SPORE},
+ .nature = NATURE_RASH,
+ .gender = MALE
+ },
+ {
+ .side = 1,
+ .level = 11,
+ .species = SPECIES_JIGGLYPUFF,
+ .moves = {MOVE_SING, MOVE_DEFENSE_CURL, MOVE_POUND},
+ .nature = NATURE_CAREFUL,
+ .gender = MALE
+ },
+ {0xFF}
};
-extern const struct UnkStruct_84792D0 *const gUnknown_84792D0[];
-void sub_8159F40(void)
+static const struct PokedudeBattlePartyInfo *const sPokedudeBattlePartyPointers[] = {
+ sParties_Battle,
+ sParties_Status,
+ sParties_Matchups,
+ sParties_Catching
+};
+
+void InitPokedudePartyAndOpponent(void)
{
s32 i, j;
struct Pokemon *mon;
s32 myIdx = 0;
s32 opIdx = 0;
- const struct UnkStruct_84792D0 * data;
+ const struct PokedudeBattlePartyInfo * data;
gBattleTypeFlags = BATTLE_TYPE_POKEDUDE;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
- data = gUnknown_84792D0[gSpecialVar_0x8004];
+ data = sPokedudeBattlePartyPointers[gSpecialVar_0x8004];
i = 0;
do
{
- if (data[i].field_0 == 0)
+ if (data[i].side == 0)
{
mon = &gPlayerParty[myIdx];
myIdx++;
@@ -46,15 +143,17 @@ void sub_8159F40(void)
mon = &gEnemyParty[opIdx];
opIdx++;
}
- CreateMonWithGenderNatureLetter(mon, data[i].field_2, data[i].field_1, 0, data[i].field_D, data[i].field_C, 0);
+ CreateMonWithGenderNatureLetter(mon, data[i].species, data[i].level, 0, data[i].gender, data[i].nature, 0);
for (j = 0; j < 4; j++)
{
- SetMonMoveSlot(mon, data[i].field_4[j], j);
+ SetMonMoveSlot(mon, data[i].moves[j], j);
}
i++;
- } while (data[i].field_0 != 0xFF);
+ } while (data[i].side != 0xFF);
}
+// file boundary?
+
void sub_815A008(struct QuestLog * questLog)
{
u32 i;