mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Decompiled sub_81C742C
This commit is contained in:
parent
cf721879dd
commit
3d73f7c48c
140
asm/pokenav.s
140
asm/pokenav.s
@ -5,146 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81C742C
|
||||
sub_81C742C: @ 81C742C
|
||||
push {r4-r7,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 3
|
||||
ldr r0, =gTasks + 0x8
|
||||
adds r7, r1, r0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r7, r1]
|
||||
cmp r0, 0x5
|
||||
bls _081C7446
|
||||
b _081C7562
|
||||
_081C7446:
|
||||
lsls r0, 2
|
||||
ldr r1, =_081C7458
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081C7458:
|
||||
.4byte _081C7470
|
||||
.4byte _081C747A
|
||||
.4byte _081C7490
|
||||
.4byte _081C749C
|
||||
.4byte _081C751E
|
||||
.4byte _081C752C
|
||||
_081C7470:
|
||||
bl sub_81C76C4
|
||||
movs r0, 0x1
|
||||
strh r0, [r7]
|
||||
b _081C7562
|
||||
_081C747A:
|
||||
bl sub_81C76FC
|
||||
cmp r0, 0
|
||||
bne _081C7562
|
||||
ldr r0, =0x000186a0
|
||||
bl sub_81C756C
|
||||
b _081C74E8
|
||||
.pool
|
||||
_081C7490:
|
||||
bl sub_81C786C
|
||||
cmp r0, 0
|
||||
bne _081C7562
|
||||
movs r0, 0x3
|
||||
strh r0, [r7]
|
||||
_081C749C:
|
||||
bl sub_81C75E0
|
||||
adds r6, r0, 0
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
cmp r6, r0
|
||||
beq _081C74FC
|
||||
ldr r0, =0x0001869f
|
||||
cmp r6, r0
|
||||
bls _081C7506
|
||||
ldr r4, =gUnknown_0861F3EC
|
||||
ldr r5, =gUnknown_0203CF40
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r0, 0x4]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x18
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r0, 0x4]
|
||||
lsls r0, r1, 3
|
||||
subs r0, r1
|
||||
lsls r0, 2
|
||||
adds r4, 0x14
|
||||
adds r0, r4
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
adds r0, r6, 0
|
||||
bl sub_81C756C
|
||||
cmp r0, 0
|
||||
beq _081C74FC
|
||||
_081C74E8:
|
||||
movs r0, 0x4
|
||||
strh r0, [r7]
|
||||
b _081C7562
|
||||
.pool
|
||||
_081C74FC:
|
||||
bl sub_81C7710
|
||||
movs r0, 0x5
|
||||
strh r0, [r7]
|
||||
b _081C7562
|
||||
_081C7506:
|
||||
cmp r6, 0
|
||||
beq _081C7562
|
||||
adds r0, r6, 0
|
||||
bl sub_81C7850
|
||||
bl sub_81C786C
|
||||
cmp r0, 0
|
||||
beq _081C7562
|
||||
movs r0, 0x2
|
||||
strh r0, [r7]
|
||||
b _081C7562
|
||||
_081C751E:
|
||||
bl sub_81C75D4
|
||||
cmp r0, 0
|
||||
bne _081C7562
|
||||
movs r0, 0x3
|
||||
strh r0, [r7]
|
||||
b _081C7562
|
||||
_081C752C:
|
||||
bl sub_81C7738
|
||||
cmp r0, 0
|
||||
bne _081C7562
|
||||
ldr r0, =gUnknown_0203CF40
|
||||
ldr r0, [r0]
|
||||
ldrh r0, [r0, 0x8]
|
||||
negs r4, r0
|
||||
orrs r4, r0
|
||||
lsrs r4, 31
|
||||
bl sub_81C9430
|
||||
bl sub_81C7334
|
||||
cmp r4, 0
|
||||
beq _081C755C
|
||||
ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic
|
||||
bl SetMainCallback2
|
||||
b _081C7562
|
||||
.pool
|
||||
_081C755C:
|
||||
ldr r0, =CB2_ReturnToFieldWithOpenMenu
|
||||
bl SetMainCallback2
|
||||
_081C7562:
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81C742C
|
||||
|
||||
thumb_func_start sub_81C756C
|
||||
sub_81C756C: @ 81C756C
|
||||
push {r4-r6,lr}
|
||||
|
@ -8,25 +8,41 @@
|
||||
#include "pokemon_storage_system.h"
|
||||
|
||||
struct UnknownStruct_0203CF40 {
|
||||
u32 field_0;
|
||||
u32 field_1;
|
||||
u16 field_2;
|
||||
u32 field_3;
|
||||
u32 field_4;
|
||||
u32 field_5[18];
|
||||
u32 field0;
|
||||
u32 field4;
|
||||
u16 field8;
|
||||
u32 fieldC;
|
||||
u32 field10;
|
||||
u32 field14[18];
|
||||
};
|
||||
|
||||
struct UnknownStruct_0861F3EC {
|
||||
void (*data[7])(void);
|
||||
};
|
||||
|
||||
extern struct UnknownStruct_0203CF40 *gUnknown_0203CF40;
|
||||
extern u8 gUnknown_0203CF3C;
|
||||
extern struct UnknownStruct_0861F3EC gUnknown_0861F3EC[7]; // Unknown size; at least 7.
|
||||
|
||||
extern void sub_81C742C(u8 taskId);
|
||||
extern void sub_81C7400(void);
|
||||
extern void sub_81C7418(void);
|
||||
extern void sub_81C7170(u8 a0);
|
||||
extern void sub_81C71E4(u8 a0);
|
||||
extern void sub_81C7650(s32 a0);
|
||||
extern u32 AnyMonHasRibbon(void);
|
||||
extern void sub_81C76C4(void);
|
||||
extern void sub_81C7710(void);
|
||||
extern void sub_81C7850(u32 a0);
|
||||
extern void sub_81C9430(void);
|
||||
extern u32 sub_81C756C(u32 a0);
|
||||
extern u32 sub_81C76FC(void);
|
||||
extern u32 sub_81C786C(void);
|
||||
extern u32 sub_81C75E0(void);
|
||||
extern u32 sub_81C75D4(void);
|
||||
extern u32 sub_81C7738(void);
|
||||
|
||||
u32 AnyMonHasRibbon(void);
|
||||
void sub_81C7334(void);
|
||||
void sub_81C71E4(u8 a0);
|
||||
void sub_81C7170(u8 a0);
|
||||
void sub_81C7418(void);
|
||||
void sub_81C7400(void);
|
||||
void sub_81C742C(u8 taskId);
|
||||
void sub_81C72BC(void);
|
||||
void sub_81C7360(struct UnknownStruct_0203CF40 *a0);
|
||||
|
||||
@ -165,7 +181,7 @@ void sub_81C72BC() {
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
} else {
|
||||
sub_81C7360(gUnknown_0203CF40);
|
||||
gUnknown_0203CF40->field_2 = 1;
|
||||
gUnknown_0203CF40->field8 = 1;
|
||||
ResetTasks();
|
||||
ResetSpriteData();
|
||||
FreeAllSpritePalettes();
|
||||
@ -196,15 +212,15 @@ void sub_81C7360(struct UnknownStruct_0203CF40 *a0) {
|
||||
|
||||
fill = 0;
|
||||
i = 18;
|
||||
arrayPtr = &(a0->field_5[17]);
|
||||
arrayPtr = &(a0->field14[17]);
|
||||
for (i; i >= 0; i--) {
|
||||
*arrayPtr = fill;
|
||||
arrayPtr -= 1;
|
||||
}
|
||||
a0->field_2 = 0;
|
||||
a0->field_1 = 0;
|
||||
a0->field_3 = AnyMonHasRibbon();
|
||||
a0->field_0 = 0;
|
||||
a0->field8 = 0;
|
||||
a0->field4 = 0;
|
||||
a0->fieldC = AnyMonHasRibbon();
|
||||
a0->field0 = 0;
|
||||
}
|
||||
|
||||
bool32 AnyMonHasRibbon() {
|
||||
@ -245,3 +261,67 @@ void sub_81C7418() {
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
}
|
||||
|
||||
void sub_81C742C(u8 taskId) {
|
||||
s16* dataPtr;
|
||||
u32 v1;
|
||||
bool32 v2;
|
||||
|
||||
dataPtr = gTasks[taskId].data;
|
||||
|
||||
switch (dataPtr[0]) {
|
||||
case 0:
|
||||
sub_81C76C4();
|
||||
dataPtr[0] = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (sub_81C76FC()) {
|
||||
break;
|
||||
}
|
||||
sub_81C756C(0x186a0);
|
||||
dataPtr[0] = 4;
|
||||
break;
|
||||
case 2:
|
||||
if (sub_81C786C()) {
|
||||
break;
|
||||
}
|
||||
dataPtr[0] = 3;
|
||||
case 3:
|
||||
v1 = sub_81C75E0();
|
||||
if (v1 == -1) {
|
||||
sub_81C7710();
|
||||
dataPtr[0] = 5;
|
||||
} else if (v1 > 0x1869F) {
|
||||
gUnknown_0861F3EC[gUnknown_0203CF40->field4].data[6]();
|
||||
gUnknown_0861F3EC[gUnknown_0203CF40->field4].data[5]();
|
||||
if (sub_81C756C(v1)) {
|
||||
dataPtr[0] = 4;
|
||||
} else {
|
||||
sub_81C7710();
|
||||
dataPtr[0] = 5;
|
||||
}
|
||||
} else if (v1 != 0) {
|
||||
sub_81C7850(v1);
|
||||
if (sub_81C786C()) {
|
||||
dataPtr[0] = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (!sub_81C75D4()) {
|
||||
dataPtr[0] = 3;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (!sub_81C7738()) {
|
||||
v2 = gUnknown_0203CF40->field8 != 0;
|
||||
sub_81C9430();
|
||||
sub_81C7334();
|
||||
if (v2) {
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
} else {
|
||||
SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user