decomp sub_80847D4

This commit is contained in:
Seth Barberee 2024-07-21 14:57:00 -07:00
parent 3d73fd4735
commit 1064b6c1a0
4 changed files with 45 additions and 85 deletions

View File

@ -1,73 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_80847D4
sub_80847D4:
push {r4,r5,lr}
ldr r2, _08084820
ldr r0, [r2]
ldr r1, _08084824
adds r0, r1
movs r1, 0
strb r1, [r0]
ldr r0, [r2]
ldr r2, _08084828
adds r0, r2
strb r1, [r0]
bl sub_8040A84
movs r4, 0
ldr r0, _0808482C
ldrb r0, [r0]
cmp r0, 0
beq _08084846
movs r3, 0
_080847FA:
ldr r0, _08084820
ldr r0, [r0]
ldr r5, _08084830
adds r0, r5
movs r2, 0
ldrsh r1, [r0, r2]
adds r0, r1, 0
subs r0, 0x1C
cmp r0, 0x15
bhi _08084810
movs r1, 0x1B
_08084810:
ldr r2, _0808482C
adds r0, r3, r2
ldrb r5, [r0]
cmp r1, r5
bne _08084834
bl sub_8084854
b _08084846
.align 2, 0
_08084820: .4byte gDungeon
_08084824: .4byte 0x00003a0d
_08084828: .4byte 0x0001356c
_0808482C: .4byte gUnknown_8107234
_08084830: .4byte 0x00003a14
_08084834:
adds r3, 0x8
adds r4, 0x1
ldr r0, _08084850
cmp r4, r0
bgt _08084846
adds r0, r3, r2
ldrb r0, [r0]
cmp r0, 0
bne _080847FA
_08084846:
bl sub_8097FF8
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08084850: .4byte 0x000003e6
thumb_func_end sub_80847D4
.align 2,0

View File

@ -4,5 +4,6 @@
#include "structs/dungeon_entity.h"
u8 GetApparentWeather(Entity *pokemon);
void sub_807E5E4(u8 weather);
#endif

View File

@ -296,7 +296,6 @@ SECTIONS {
src/code_808417C.o(.text);
asm/code_808417C.o(.text);
src/code_8084778.o(.text);
asm/code_80847D4.o(.text);
src/code_80848F0.o(.text);
asm/code_80848F0.o(.text);
src/dungeon_util_1.o(.text);

View File

@ -1,7 +1,9 @@
#include "global.h"
#include "constants/weather.h"
#include "structs/str_dungeon.h"
#include "dungeon_music.h"
#include "exclusive_pokemon.h"
#include "weather.h"
extern void SkarmoryPreFightDialogue();
extern void SkarmoryReFightDialogue();
@ -143,35 +145,66 @@ extern void sub_808C9C4(void);
extern void sub_808CB5C(void);
extern void sub_808CBB0(void);
extern void sub_808CD44(void);
extern void sub_8040A84(void);
extern void sub_807E5E4(u32);
struct unkData_8107234
{
u8 unk0[8];
};
void sub_8084854(u8 *param_1)
extern struct unkData_8107234 gUnknown_8107234[];
void sub_8084854(struct unkData_8107234 *);
void sub_80847D4(void)
{
u32 bossBattleIndex;
s32 index;
gDungeon->unk3A0D = 0;
gDungeon->unk1356C = 0;
sub_8040A84();
for(index = 0; index < 0x3e7 && gUnknown_8107234[index].unk0[0] != 0; index++) {
bossBattleIndex = gDungeon->bossBattleIndex;
if (bossBattleIndex - 0x1c < 0x16) {
bossBattleIndex = 0x1b;
}
if (bossBattleIndex == gUnknown_8107234[index].unk0[0])
{
sub_8084854(&gUnknown_8107234[index]);
break;
}
}
sub_8097FF8();
}
void sub_8084854(struct unkData_8107234 *param_1)
{
if (gDungeon->unk678 != 0) {
gDungeon->unk3A0D = param_1[5];
gDungeon->unk3A0D = param_1->unk0[5];
}
else
{
if (sub_8098100(param_1[4]) != 0) {
gDungeon->unk3A0D = param_1[5];
if (sub_8098100(param_1->unk0[4]) != 0) {
gDungeon->unk3A0D = param_1->unk0[5];
}
else
{
if (sub_8098100(param_1[2]) != 0) {
gDungeon->unk3A0D = param_1[3];
if (sub_8098100(param_1->unk0[2]) != 0) {
gDungeon->unk3A0D = param_1->unk0[3];
}
else
{
gDungeon->unk3A0D = param_1[1];
if (param_1[2] != 0x40) {
sub_8097FA8(param_1[2]);
gDungeon->unk3A0D = param_1->unk0[1];
if (param_1->unk0[2] != 0x40) {
sub_8097FA8(param_1->unk0[2]);
}
}
}
}
gDungeon->unk675 = 1;
sub_807E5E4(0);
sub_807E5E4(WEATHER_CLEAR);
}
u32 sub_80848EC(void)