through BattleSetup_New_PalPark

This commit is contained in:
PikalaxALT 2023-08-20 11:19:14 -04:00
parent d6dd8f53ae
commit 1ff22ae375
No known key found for this signature in database
GPG Key ID: C7E3D40F3BAC7AEB
5 changed files with 43 additions and 60 deletions

View File

@ -31,55 +31,6 @@ _020FC4C0:
.text
thumb_func_start BattleSetup_New_SafariZone
BattleSetup_New_SafariZone: ; 0x02051A60
push {r4, lr}
add r4, r1, #0
; BATTLE_TYPE_SAFARI
mov r1, #0x20
bl BattleSetup_New
mov r1, #0x19
lsl r1, r1, #4
str r4, [r0, r1]
pop {r4, pc}
.balign 4, 0
thumb_func_end BattleSetup_New_SafariZone
thumb_func_start BattleSetup_New_BugContest
BattleSetup_New_BugContest: ; 0x02051A74
push {r4, r5, r6, lr}
add r5, r1, #0
; BATTLE_TYPE_BUG_CONTEST
mov r1, #1
lsl r1, r1, #0xc
add r6, r2, #0
bl BattleSetup_New
mov r1, #0x19
add r4, r0, #0
lsl r1, r1, #4
str r5, [r4, r1]
add r1, #0x38
ldr r1, [r4, r1]
add r0, r6, #0
bl CopyPokemonToPokemon
add r0, r4, #0
pop {r4, r5, r6, pc}
thumb_func_end BattleSetup_New_BugContest
thumb_func_start BattleSetup_New_PalPark
BattleSetup_New_PalPark: ; 0x02051A98
push {r4, lr}
add r4, r1, #0
; BATTLE_TYPE_PAL_PARK
mov r1, #2
lsl r1, r1, #8
bl BattleSetup_New
mov r1, #0x19
lsl r1, r1, #4
str r4, [r0, r1]
pop {r4, pc}
thumb_func_end BattleSetup_New_PalPark
thumb_func_start BattleSetup_New_Tutorial
BattleSetup_New_Tutorial: ; 0x02051AAC
push {r4, r5, r6, r7, lr}

View File

@ -7,6 +7,7 @@
#include "trainer_data.h"
#include "bag.h"
#include "pokedex.h"
#include "unk_02067A60.h"
struct BattleSetupSub_138 {
int unk_0;
@ -29,7 +30,7 @@ struct BATTLE_SETUP { //declared in trainer_data.h
void* unk_128;
void* unk_12C;
OPTIONS* options;
void* unk_134;
struct UnkStruct_02067A60* unk_134;
struct BattleSetupSub_138 unk138;
void* unk_144;
int unk_148;
@ -47,7 +48,7 @@ struct BATTLE_SETUP { //declared in trainer_data.h
int levelUpFlag;
u8 filler_17C[0x10];
u32 unk_18C;
int unk_190;
int safariBalls;
void* unk_194;
u8 filler_198[4];
int unk_19C;
@ -60,23 +61,26 @@ struct BATTLE_SETUP { //declared in trainer_data.h
int unk1BC;
int unk1C0;
int unk1C4;
Pokemon* unk1C8;
Pokemon* bugContestMon;
u8 unk1CC[4];
u8 filler_1D0[4];
};
BATTLE_SETUP *BattleSetup_New(HeapID heapId, u32 battleFlags);
BATTLE_SETUP* BattleSetup_New_SafariZone(HeapID heapId, int balls);
BATTLE_SETUP* BattleSetup_New_BugContest(HeapID heapId, int balls, Pokemon* bugmon);
BATTLE_SETUP* BattleSetup_New_PalPark(HeapID heapId, int balls);
BATTLE_SETUP *BattleSetup_New_Tutorial(HeapID heapId, FieldSystem *fsys);
BOOL IsBattleResultWin(u32 a0);
int sub_02052564(u32 a0);
int sub_02052574(u32 a0);
void BattleSetup_Delete(BATTLE_SETUP *setup);
BATTLE_SETUP *BattleSetup_New_Tutorial(HeapID heapId, FieldSystem *fsys);
void sub_02052444(BATTLE_SETUP *setup, FieldSystem *fsys);
void BattleSetup_InitFromFsys(BATTLE_SETUP *setup, FieldSystem *fsys);
BATTLE_SETUP *BattleSetup_New(HeapID heapId, u32 battleFlags);
void sub_020522F0(BATTLE_SETUP *setup, FieldSystem *fsys, void *a1);
void sub_02051F2C(BATTLE_SETUP *setup, FieldSystem *fsys, int level);
void sub_020520B0(BATTLE_SETUP *setup, FieldSystem *fsys, PARTY *party, void *a4);
BATTLE_SETUP* BattleSetup_New_PalPark(HeapID heapId, int monsRemaining);
void BattleSetup_AddMonToParty(BATTLE_SETUP* setup, Pokemon* mon, int battler);
#endif //POKEHEARTGOLD_BATTLE_SETUP_H

10
include/unk_02067A60.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef POKEHEARTGOLD_UNK_02067A60_H
#define POKEHEARTGOLD_UNK_02067A60_H
#include "heap.h"
struct UnkStruct_02067A60;
struct UnkStruct_02067A60* sub_02067A60(HeapID heapId);
#endif //POKEHEARTGOLD_UNK_02067A60_H

View File

@ -3,8 +3,7 @@
#include "system.h"
#include "gf_rtc.h"
#include "unk_02035900.h"
extern void* sub_02067A60(HeapID heapId);
#include "constants/battle.h"
BATTLE_SETUP* BattleSetup_New(HeapID heapId, u32 battleTypeFlags) {
int i;
@ -35,11 +34,11 @@ BATTLE_SETUP* BattleSetup_New(HeapID heapId, u32 battleTypeFlags) {
setup->unk_134 = sub_02067A60(heapId);
setup->unk_10C = NULL;
setup->unk1B8 = NULL;
setup->unk_190 = 0;
setup->safariBalls = 0;
setup->unk_12C = NULL;
setup->unk_144 = NULL;
setup->unk_194 = NULL;
setup->unk1C8 = AllocMonZeroed(heapId);
setup->bugContestMon = AllocMonZeroed(heapId);
{
RTCDate date;
@ -62,3 +61,22 @@ BATTLE_SETUP* BattleSetup_New(HeapID heapId, u32 battleTypeFlags) {
MI_CpuClear8(&setup->unk138, sizeof(setup->unk138));
return setup;
}
BATTLE_SETUP* BattleSetup_New_SafariZone(HeapID heapId, int balls) {
BATTLE_SETUP* setup = BattleSetup_New(heapId, BATTLE_TYPE_SAFARI);
setup->safariBalls = balls;
return setup;
}
BATTLE_SETUP* BattleSetup_New_BugContest(HeapID heapId, int balls, Pokemon* bugmon) {
BATTLE_SETUP* setup = BattleSetup_New(heapId, BATTLE_TYPE_BUG_CONTEST);
setup->safariBalls = balls;
CopyPokemonToPokemon(bugmon, setup->bugContestMon);
return setup;
}
BATTLE_SETUP* BattleSetup_New_PalPark(HeapID heapId, int balls) {
BATTLE_SETUP* setup = BattleSetup_New(heapId, BATTLE_TYPE_PAL_PARK);
setup->safariBalls = balls;
return setup;
}

View File

@ -505,7 +505,7 @@ static BOOL Task_BugContestEncounter(TaskManager *man) {
sub_02051660(fsys, encounter->setup);
if (encounter->setup->winFlag == 4) {
sub_0206DB94(man, encounter->setup->unk1C8);
sub_0206DB94(man, encounter->setup->bugContestMon);
sub_02093070(fsys);
sub_020930C4(fsys);
}