Document unk_8159F40 (pokedude battle party info)

This commit is contained in:
PikalaxALT
2019-10-22 11:24:09 -04:00
parent aabb95139d
commit 949a4c3b5d
8 changed files with 126 additions and 22 deletions
+1 -1
View File
@@ -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
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -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
+2
View File
@@ -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"
+1 -1
View File
@@ -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 *);
+3
View File
@@ -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);
+1 -1
View File
@@ -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;
+114 -15
View File
@@ -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;
};
extern const struct UnkStruct_84792D0 *const gUnknown_84792D0[];
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}
};
void sub_8159F40(void)
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}
};
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;