mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-27 15:00:33 +00:00
sub_8060E38
This commit is contained in:
parent
733e4d4bfc
commit
3b4e83a9b6
@ -7,369 +7,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_8060E38
|
||||
sub_8060E38:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x7C
|
||||
str r0, [sp, 0x78]
|
||||
add r4, sp, 0x18
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
movs r2, 0x60
|
||||
bl memset
|
||||
movs r0, 0x6
|
||||
str r0, [r4, 0x4]
|
||||
movs r0, 0x2
|
||||
strh r0, [r4, 0x8]
|
||||
strh r0, [r4, 0xA]
|
||||
movs r0, 0xE
|
||||
strh r0, [r4, 0xC]
|
||||
movs r0, 0x10
|
||||
strh r0, [r4, 0xE]
|
||||
strh r0, [r4, 0x10]
|
||||
ldr r0, _08061018
|
||||
str r0, [r4, 0x14]
|
||||
movs r0, 0x3
|
||||
str r0, [r4, 0x1C]
|
||||
str r0, [r4, 0x34]
|
||||
str r0, [r4, 0x4C]
|
||||
movs r5, 0
|
||||
mov r9, r4
|
||||
add r0, sp, 0x4
|
||||
mov r8, r0
|
||||
_08060E7A:
|
||||
ldr r6, _0806101C
|
||||
ldr r0, [r6]
|
||||
lsls r1, r5, 2
|
||||
ldr r2, _08061020
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060E9E
|
||||
ldr r0, [r4, 0x70]
|
||||
ldr r2, _08061024
|
||||
adds r1, r0, r2
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
_08060E9E:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _08060E7A
|
||||
ldr r0, [r6]
|
||||
ldr r1, _08061028
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08060EBC
|
||||
movs r0, 0x3
|
||||
mov r2, r9
|
||||
str r0, [r2, 0x4]
|
||||
ldrh r0, [r2, 0xA]
|
||||
adds r0, 0x1
|
||||
strh r0, [r2, 0xA]
|
||||
_08060EBC:
|
||||
ldr r6, _0806102C
|
||||
_08060EBE:
|
||||
movs r7, 0
|
||||
mov r0, sp
|
||||
mov r1, r9
|
||||
movs r2, 0x1
|
||||
bl DrawFieldTeamMenu
|
||||
movs r0, 0
|
||||
mov r10, r0
|
||||
_08060ECE:
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r6, r1]
|
||||
lsls r0, 2
|
||||
add r0, r8
|
||||
ldr r1, [r0]
|
||||
cmp r1, 0
|
||||
blt _08060F00
|
||||
ldr r0, _0806101C
|
||||
ldr r0, [r0]
|
||||
lsls r1, 2
|
||||
ldr r2, _08061020
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl sub_806A2BC
|
||||
adds r4, 0x4
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
movs r2, 0x1
|
||||
movs r3, 0x1
|
||||
bl sub_804A728
|
||||
_08060F00:
|
||||
adds r0, r6, 0
|
||||
bl AddMenuCursorSprite
|
||||
movs r0, 0x1B
|
||||
bl sub_803E46C
|
||||
ldr r4, _08061030
|
||||
ldrh r1, [r4, 0x4]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060F26
|
||||
movs r0, 0x1
|
||||
bl sub_8083CE0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x1
|
||||
bl sub_80136E0
|
||||
_08060F26:
|
||||
ldrh r1, [r4, 0x4]
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060F3E
|
||||
movs r0, 0x1
|
||||
bl sub_8083CE0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x1
|
||||
bl sub_8013744
|
||||
_08060F3E:
|
||||
ldrh r1, [r4, 0x2]
|
||||
movs r0, 0x8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060F5A
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r6, r1]
|
||||
add r1, sp, 0x14
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _08061046
|
||||
bl sub_8083D30
|
||||
_08060F5A:
|
||||
ldrh r1, [r4, 0x2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08060F6C
|
||||
ldr r2, _08061034
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
beq _08060F7E
|
||||
_08060F6C:
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r6, r1]
|
||||
add r1, sp, 0x14
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _08061040
|
||||
bl sub_8083D30
|
||||
_08060F7E:
|
||||
ldr r0, _08061030
|
||||
ldrh r1, [r0, 0x2]
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08060F92
|
||||
ldr r2, _08061038
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
beq _08060ECE
|
||||
_08060F92:
|
||||
bl sub_8083D30
|
||||
movs r7, 0x1
|
||||
_08060F98:
|
||||
ldr r5, _0806102C
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r5, r1]
|
||||
lsls r0, 2
|
||||
add r0, r8
|
||||
ldr r1, [r0]
|
||||
cmp r1, 0
|
||||
blt _08060FCC
|
||||
ldr r0, _0806101C
|
||||
ldr r0, [r0]
|
||||
lsls r1, 2
|
||||
ldr r2, _08061020
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl sub_806A2BC
|
||||
adds r4, 0x4
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
movs r2, 0x1
|
||||
movs r3, 0x1
|
||||
bl sub_804A728
|
||||
_08060FCC:
|
||||
adds r0, r5, 0
|
||||
bl AddMenuCursorSprite
|
||||
movs r0, 0x1B
|
||||
bl sub_803E46C
|
||||
bl sub_804AA60
|
||||
cmp r7, 0
|
||||
beq _08060FE2
|
||||
b _0806110C
|
||||
_08060FE2:
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r5, r1]
|
||||
str r0, [sp]
|
||||
ldr r1, _0806103C
|
||||
movs r2, 0x18
|
||||
ldrsh r0, [r5, r2]
|
||||
str r0, [r1]
|
||||
mov r0, sp
|
||||
bl sub_806145C
|
||||
mov r0, r10
|
||||
cmp r0, 0
|
||||
beq _08061064
|
||||
ldr r1, [sp, 0x78]
|
||||
ldr r4, [r1, 0x70]
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x44
|
||||
movs r1, 0x1B
|
||||
bl SetMonsterActionFields
|
||||
ldr r0, [sp]
|
||||
lsls r0, 2
|
||||
add r0, r8
|
||||
ldr r0, [r0]
|
||||
adds r4, 0x48
|
||||
strb r0, [r4]
|
||||
b _08061116
|
||||
.align 2, 0
|
||||
_08061018: .4byte gUnknown_202F270
|
||||
_0806101C: .4byte gDungeon
|
||||
_08061020: .4byte 0x0001357c
|
||||
_08061024: .4byte 0x00000157
|
||||
_08061028: .4byte 0x0000065b
|
||||
_0806102C: .4byte gUnknown_202EE10
|
||||
_08061030: .4byte gRealInputs
|
||||
_08061034: .4byte gUnknown_202EE39
|
||||
_08061038: .4byte gUnknown_202EE3A
|
||||
_0806103C: .4byte gUnknown_202F260
|
||||
_08061040:
|
||||
bl sub_8083D08
|
||||
b _08060F98
|
||||
_08061046:
|
||||
bl sub_8083D44
|
||||
movs r2, 0x1
|
||||
mov r10, r2
|
||||
b _08060F98
|
||||
_08061050:
|
||||
ldr r1, [sp, 0x78]
|
||||
ldr r0, [r1, 0x70]
|
||||
adds r0, 0x44
|
||||
mov r1, sp
|
||||
bl sub_80615B4
|
||||
bl sub_8083D08
|
||||
movs r4, 0
|
||||
b _080610EA
|
||||
_08061064:
|
||||
mov r0, r9
|
||||
movs r1, 0x12
|
||||
bl sub_805FC30
|
||||
adds r4, r5, 0
|
||||
ldr r5, _08061100
|
||||
adds r7, r4, 0
|
||||
adds r7, 0x2A
|
||||
_08061074:
|
||||
adds r0, r4, 0
|
||||
bl AddMenuCursorSprite
|
||||
movs r0, 0x1B
|
||||
bl sub_803E46C
|
||||
ldrh r1, [r5, 0x4]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08061098
|
||||
movs r0, 0x1
|
||||
bl sub_8083CE0
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl sub_80136E0
|
||||
_08061098:
|
||||
ldrh r1, [r5, 0x4]
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080610B0
|
||||
movs r0, 0x1
|
||||
bl sub_8083CE0
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl sub_8013744
|
||||
_080610B0:
|
||||
ldrh r1, [r5, 0x2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080610C2
|
||||
ldr r2, _08061104
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
beq _080610D4
|
||||
_080610C2:
|
||||
movs r1, 0x18
|
||||
ldrsh r0, [r4, r1]
|
||||
bl sub_8044F3C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08061050
|
||||
bl sub_8083D30
|
||||
_080610D4:
|
||||
ldrh r1, [r5, 0x2]
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080610E4
|
||||
ldrb r0, [r7]
|
||||
cmp r0, 0
|
||||
beq _08061074
|
||||
_080610E4:
|
||||
bl sub_8083D30
|
||||
movs r4, 0x1
|
||||
_080610EA:
|
||||
ldr r0, _08061108
|
||||
bl AddMenuCursorSprite
|
||||
movs r0, 0x1B
|
||||
bl sub_803E46C
|
||||
cmp r4, 0x1
|
||||
bne _080610FC
|
||||
b _08060EBE
|
||||
_080610FC:
|
||||
movs r7, 0
|
||||
b _08061116
|
||||
.align 2, 0
|
||||
_08061100: .4byte gRealInputs
|
||||
_08061104: .4byte gUnknown_202EE39
|
||||
_08061108: .4byte gUnknown_202EE10
|
||||
_0806110C:
|
||||
bl GetLeader
|
||||
movs r1, 0
|
||||
bl sub_806A2BC
|
||||
_08061116:
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl sub_803EAF0
|
||||
adds r0, r7, 0
|
||||
add sp, 0x7C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8060E38
|
||||
|
||||
thumb_func_start DrawFieldTeamMenu
|
||||
DrawFieldTeamMenu:
|
||||
push {r4-r7,lr}
|
||||
|
@ -4225,3 +4225,164 @@ s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
extern UnkTextStruct2_sub2 gUnknown_202F270;
|
||||
|
||||
struct UnkFieldTeamMenuStruct
|
||||
{
|
||||
s32 unk0;
|
||||
s32 unk4[MAX_TEAM_MEMBERS];
|
||||
u8 unk14[MAX_TEAM_MEMBERS];
|
||||
};
|
||||
|
||||
void DrawFieldTeamMenu(struct UnkFieldTeamMenuStruct *a0, UnkTextStruct3 *a1, bool8 a2);
|
||||
void sub_806145C(struct UnkFieldTeamMenuStruct *a0);
|
||||
void sub_80615B4(ActionContainer *a0, struct UnkFieldTeamMenuStruct *a1);
|
||||
|
||||
extern u8 gUnknown_202EE39;
|
||||
|
||||
bool8 sub_8060E38(Entity *a0)
|
||||
{
|
||||
s32 i;
|
||||
bool32 r10, ret;
|
||||
|
||||
struct UnkFieldTeamMenuStruct sp;
|
||||
UnkTextStruct3 var_84 = {0};
|
||||
|
||||
var_84.a0[0].unk4 = 6;
|
||||
var_84.a0[0].unk8.unk0.separate.unk0 = 2;
|
||||
var_84.a0[0].unk8.unk0.separate.unk2 = 2;
|
||||
var_84.a0[0].unkC = 0xE;
|
||||
var_84.a0[0].unkE = 0x10;
|
||||
var_84.a0[0].unk10 = 0x10;
|
||||
var_84.a0[0].unk14 = &gUnknown_202F270;
|
||||
var_84.a0[1].unk4 = 3;
|
||||
var_84.a0[2].unk4 = 3;
|
||||
var_84.a0[3].unk4 = 3;
|
||||
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
Entity *teamMon = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(teamMon)) {
|
||||
teamMon->info->unk157 = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gDungeon->unk65B) {
|
||||
var_84.a0[0].unk4 = 3;
|
||||
var_84.a0[0].unk8.unk0.arr[1]++;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
s32 id;
|
||||
bool32 r4;
|
||||
|
||||
ret = FALSE;
|
||||
DrawFieldTeamMenu(&sp, &var_84, TRUE);
|
||||
r10 = FALSE;
|
||||
while (1) {
|
||||
s32 id = sp.unk4[gUnknown_202EE10.menuIndex];
|
||||
if (id >= 0) {
|
||||
Entity *teamMon = gDungeon->teamPokemon[id];
|
||||
sub_806A2BC(teamMon, 0);
|
||||
sub_804A728(&teamMon->pos, 0, 1, 1);
|
||||
}
|
||||
|
||||
AddMenuCursorSprite(&gUnknown_202EE10);
|
||||
sub_803E46C(0x1B);
|
||||
if (gRealInputs.repeated & DPAD_DOWN) {
|
||||
sub_8083CE0(1);
|
||||
sub_80136E0(&gUnknown_202EE10, 1);
|
||||
}
|
||||
if (gRealInputs.repeated & DPAD_UP) {
|
||||
sub_8083CE0(1);
|
||||
sub_8013744(&gUnknown_202EE10, 1);
|
||||
}
|
||||
if (gRealInputs.pressed & START_BUTTON) {
|
||||
if (sp.unk14[gUnknown_202EE10.menuIndex] != 0) {
|
||||
sub_8083D44();
|
||||
r10 = TRUE;
|
||||
break;
|
||||
}
|
||||
sub_8083D30();
|
||||
}
|
||||
if ((gRealInputs.pressed & A_BUTTON) || gUnknown_202EE10.unk28.a_button)
|
||||
{
|
||||
if (sp.unk14[gUnknown_202EE10.menuIndex] != 0) {
|
||||
sub_8083D08();
|
||||
break;
|
||||
}
|
||||
sub_8083D30();
|
||||
}
|
||||
if ((gRealInputs.pressed & B_BUTTON) || gUnknown_202EE10.unk28.b_button) {
|
||||
sub_8083D30();
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
id = sp.unk4[gUnknown_202EE10.menuIndex];
|
||||
if (id >= 0) {
|
||||
Entity *teamMon = gDungeon->teamPokemon[id];
|
||||
sub_806A2BC(teamMon, 0);
|
||||
sub_804A728(&teamMon->pos, 0, 1, 1);
|
||||
}
|
||||
|
||||
AddMenuCursorSprite(&gUnknown_202EE10);
|
||||
sub_803E46C(0x1B);
|
||||
sub_804AA60();
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
|
||||
sp.unk0 = gUnknown_202EE10.menuIndex;
|
||||
gUnknown_202F260 = gUnknown_202EE10.menuIndex;
|
||||
sub_806145C(&sp);
|
||||
if (r10) {
|
||||
EntityInfo *info = a0->info;
|
||||
SetMonsterActionFields(&info->action, 0x1B);
|
||||
info->action.unk4[0].actionUseIndex = sp.unk4[sp.unk0];
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
sub_805FC30(&var_84, 0x12);
|
||||
while (1) {
|
||||
AddMenuCursorSprite(&gUnknown_202EE10);
|
||||
sub_803E46C(0x1B);
|
||||
if (gRealInputs.repeated & DPAD_DOWN) {
|
||||
sub_8083CE0(1);
|
||||
sub_80136E0(&gUnknown_202EE10, 1);
|
||||
}
|
||||
if (gRealInputs.repeated & DPAD_UP) {
|
||||
sub_8083CE0(1);
|
||||
sub_8013744(&gUnknown_202EE10, 1);
|
||||
}
|
||||
if ((gRealInputs.pressed & A_BUTTON) || gUnknown_202EE10.unk28.a_button) {
|
||||
if (sub_8044F3C(gUnknown_202EE10.menuIndex)) {
|
||||
sub_80615B4(&a0->info->action, &sp);
|
||||
sub_8083D08();
|
||||
r4 = FALSE;
|
||||
break;
|
||||
}
|
||||
sub_8083D30();
|
||||
}
|
||||
if ((gRealInputs.pressed & B_BUTTON) || gUnknown_202EE10.unk28.b_button) {
|
||||
sub_8083D30();
|
||||
r4 = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddMenuCursorSprite(&gUnknown_202EE10);
|
||||
sub_803E46C(0x1B);
|
||||
if (r4 != TRUE) {
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
sub_806A2BC(GetLeader(), 0);
|
||||
}
|
||||
sub_803EAF0(0, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user