Skip to content

Commit

Permalink
more decomp work
Browse files Browse the repository at this point in the history
  • Loading branch information
SethBarberee committed Oct 31, 2023
1 parent 4488244 commit 937d4c9
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 235 deletions.
139 changes: 0 additions & 139 deletions asm/code_8073CF0.s
Original file line number Diff line number Diff line change
Expand Up @@ -3200,143 +3200,4 @@ _080756FC: .4byte gDungeon
_08075700: .4byte 0x000135cc
thumb_func_end sub_8075680

thumb_func_start nullsub_97
nullsub_97:
bx lr
thumb_func_end nullsub_97

thumb_func_start sub_8075708
sub_8075708:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r4, r0, 0
ldr r6, [r4, 0x70]
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _0807580C
adds r0, r4, 0
bl GetTileAtEntitySafe
adds r5, r0, 0
adds r0, r4, 0
movs r1, 0xD
bl IQSkillIsEnabled
lsls r0, 24
cmp r0, 0
beq _08075752
adds r0, r6, 0
adds r0, 0xE4
ldrb r0, [r0]
cmp r0, 0x3
beq _08075752
adds r0, r4, 0
movs r1, 0x9
bl HasHeldItem
lsls r0, 24
cmp r0, 0
bne _08075752
adds r0, r4, 0x4
bl sub_804AE84
_08075752:
ldr r5, [r5, 0x14]
cmp r5, 0
beq _0807580C
adds r0, r5, 0
bl GetEntityType
cmp r0, 0x5
bhi _0807580C
lsls r0, 2
ldr r1, _0807576C
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0807576C: .4byte _08075770
.align 2, 0
_08075770:
.4byte _0807580C
.4byte _0807580C
.4byte _08075788
.4byte _08075806
.4byte _0807580C
.4byte _0807580C
_08075788:
adds r0, r5, 0
bl GetTrapData
adds r7, r0, 0
movs r0, 0
mov r8, r0
mov r9, r0
adds r0, r4, 0
movs r1, 0x13
bl IQSkillIsEnabled
lsls r0, 24
cmp r0, 0
beq _080757BA
adds r1, r5, 0
adds r1, 0x20
ldrb r0, [r1]
cmp r0, 0
bne _080757BA
movs r0, 0x1
strb r0, [r1]
bl sub_8049ED4
movs r0, 0x1
mov r9, r0
_080757BA:
ldrb r0, [r7, 0x1]
cmp r0, 0
bne _080757D2
adds r0, r5, 0
adds r0, 0x20
ldrb r0, [r0]
cmp r0, 0
beq _080757EC
ldrb r0, [r6, 0x6]
cmp r0, 0
bne _080757EC
b _080757F2
_080757D2:
cmp r0, 0x1
bne _080757DE
ldrb r0, [r6, 0x6]
cmp r0, 0
beq _080757EC
b _080757F2
_080757DE:
cmp r0, 0x2
bne _080757EC
ldrb r0, [r6, 0x6]
cmp r0, 0
bne _080757EC
movs r0, 0x1
mov r8, r0
_080757EC:
mov r0, r8
cmp r0, 0
beq _0807580C
_080757F2:
mov r0, r9
cmp r0, 0
bne _0807580C
adds r1, r4, 0x4
adds r0, r4, 0
movs r2, 0
movs r3, 0x1
bl sub_807FE9C
b _0807580C
_08075806:
adds r0, r4, 0
bl sub_8073D14
_0807580C:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8075708

.align 2,0
90 changes: 1 addition & 89 deletions asm/pokemon.s
Original file line number Diff line number Diff line change
Expand Up @@ -659,92 +659,4 @@ _0808D63E:
bx r1
thumb_func_end sub_808D580

thumb_func_start sub_808D654
sub_808D654:
push {r4-r6,lr}
adds r5, r0, 0
ldr r0, _0808D6A0
ldr r2, [r0]
movs r6, 0
movs r4, 0
adds r3, r5, 0
_0808D662:
ldrh r0, [r2]
lsrs r0, 1
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _0808D68C
ldrb r0, [r2, 0x2]
cmp r0, 0
bne _0808D68C
movs r1, 0
ldrb r0, [r2, 0x4]
cmp r0, 0x41
bne _0808D67E
movs r1, 0x1
_0808D67E:
cmp r1, 0
bne _0808D68C
cmp r5, 0
beq _0808D688
str r4, [r3]
_0808D688:
adds r3, 0x4
adds r6, 0x1
_0808D68C:
adds r4, 0x1
adds r2, 0x58
movs r0, 0xCE
lsls r0, 1
cmp r4, r0
ble _0808D662
adds r0, r6, 0
pop {r4-r6}
pop {r1}
bx r1
.align 2, 0
_0808D6A0: .4byte gRecruitedPokemonRef
thumb_func_end sub_808D654

thumb_func_start sub_808D6A4
sub_808D6A4:
push {r4-r6,lr}
adds r5, r0, 0
ldr r0, _0808D6E4
ldr r2, [r0]
movs r6, 0
movs r4, 0
adds r3, r5, 0
_0808D6B2:
ldrh r0, [r2]
lsrs r0, 1
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _0808D6CE
ldrb r0, [r2, 0x2]
cmp r0, 0
bne _0808D6CE
cmp r5, 0
beq _0808D6CA
str r4, [r3]
_0808D6CA:
adds r3, 0x4
adds r6, 0x1
_0808D6CE:
adds r4, 0x1
adds r2, 0x58
movs r0, 0xCE
lsls r0, 1
cmp r4, r0
ble _0808D6B2
adds r0, r6, 0
pop {r4-r6}
pop {r1}
bx r1
.align 2, 0
_0808D6E4: .4byte gRecruitedPokemonRef
thumb_func_end sub_808D6A4

.align 2,0
.align 2,0
8 changes: 1 addition & 7 deletions src/code_80958E8_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@
extern bool8 IsValidWonderMail(WonderMail *WonderMailData);
extern u8 sub_8095E38(WonderMail *, u8, u8, bool8);
extern void sub_80965F4();
extern void SortPelipperJobs();
u8 sub_8097318(s16 param_1);
extern bool8 GenerateMailJobInfo(WonderMail *);

bool8 sub_803C1D0(DungeonLocation *, u8);
u8 sub_8095F28(u8);
void sub_803C37C(DungeonLocation *, u8, u8 *);
bool8 sub_8096E80(u32);
u8 sub_8096E2C(void);
u8 sub_8095E78(void);

void sub_8096078(void);
s32 CountFilledMailboxSlots(void);
void ResetJobSlot(u8);
bool8 IsJobSlotEmpty(u8);
bool8 sub_80963B4(void);

static void SortMailboxSlots(void)
Expand Down Expand Up @@ -62,11 +58,9 @@ static void SortMailboxSlots(void)

void sub_80961B4(void)
{

if (sub_8096E2C() != 0) {
gUnknown_203B490->unk328 = TRUE;
}
return;
}

bool8 sub_80961D8(void)
Expand Down Expand Up @@ -103,7 +97,7 @@ bool8 sub_80961D8(void)
if(!sub_8096E80(0x32)) floor = 0x32;

}
if(GetRescueTeamRank() == 6)
if(GetRescueTeamRank() == LUCARIO_RANK)
{
if(!gUnknown_203B490->PKMNNewsReceived[0x36])
if(!sub_8096E80(0x36)) floor = 0x36;
Expand Down
74 changes: 74 additions & 0 deletions src/dungeon_ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,80 @@ extern void sub_807AB38(Entity *, u32);
extern void sub_8041888(u32);
extern u8 sub_803F428(s16 *);
extern void sub_803E708(u32, u32);
void sub_804AE84(Position *pos);
extern void sub_8049ED4();
extern void sub_8073D14(Entity *);
extern void sub_807FE9C(Entity *, Position *, u32, u32);

void nullsub_97(Entity *entity)
{}

void sub_8075708(Entity *entity)
{
bool8 bVar1;
bool8 bVar2;
Tile *tile;
u8 *trapData;
Entity *trap;
EntityInfo *info;

info = entity->info;
if (!EntityExists(entity)) {
return;
}
tile = GetTileAtEntitySafe(entity);
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->transformStatus != STATUS_MOBILE)) &&
(!HasHeldItem(entity, ITEM_MOBILE_SCARF))) {
sub_804AE84(&entity->pos);
}
trap = tile->object;
if (trap == NULL) {
return;
}

switch(GetEntityType(trap)) {
case ENTITY_TRAP:
trapData = (u8 *)GetTrapData(trap);
bVar1 = FALSE;
bVar2 = FALSE;
if ((IQSkillIsEnabled(entity, IQ_TRAP_SEER)) && (!trap->isVisible)) {
trap->isVisible = TRUE;
sub_8049ED4();
bVar2 = TRUE;
}

if (trapData[1] == 0) {
if (!trap->isVisible) goto _080757EC;
if (info->isNotTeamMember) goto _080757EC;
}
else {
if (trapData[1] == 1) {
if (!info->isNotTeamMember) goto _080757EC;
goto _ret;
}
if ((trapData[1] == 2) && (!info->isNotTeamMember)) {
bVar1 = TRUE;
}
_080757EC:
if (!bVar1) {
return;
}
}
_ret:
if (!bVar2) {
sub_807FE9C(entity, &entity->pos, 0, 1);
}
break;
case ENTITY_ITEM:
sub_8073D14(entity);
break;
case ENTITY_NOTHING:
case ENTITY_MONSTER:
case ENTITY_UNK_4:
case ENTITY_UNK_5:
break;
}
}

u32 sub_8075818(Entity *entity)
{
Expand Down
Loading

0 comments on commit 937d4c9

Please sign in to comment.