sub_8064228

This commit is contained in:
DizzyEggg
2025-03-03 12:00:11 +01:00
parent 90736d6bb2
commit 1f610267fe
3 changed files with 261 additions and 617 deletions

View File

@@ -6,589 +6,6 @@
.text
thumb_func_start sub_8063E70
sub_8063E70:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xD0
str r0, [sp, 0xC4]
adds r7, r1, 0
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0xC8]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0xCC]
add r4, sp, 0x60
adds r0, r4, 0
movs r1, 0
movs r2, 0x60
bl memset
movs r0, 0x6
str r0, [sp, 0x64]
add r0, sp, 0x68
movs r6, 0
movs r1, 0x2
strh r1, [r0]
strh r1, [r0, 0x2]
add r1, sp, 0x6C
movs r0, 0x12
strh r0, [r1]
mov r0, sp
adds r0, 0x6E
movs r1, 0x10
strh r1, [r0]
add r0, sp, 0x70
strh r1, [r0]
add r5, sp, 0xC0
str r5, [sp, 0x74]
movs r1, 0x3
str r1, [sp, 0x7C]
add r0, sp, 0x90
str r1, [r0, 0x4]
add r0, sp, 0xA8
str r1, [r0, 0x4]
mov r0, sp
adds r1, r4, 0
movs r2, 0x60
bl memcpy
ldr r0, _08063F80
str r6, [r0]
ldr r1, _08063F84
mov r8, r1
mov r9, r0
ldr r2, _08063F88
mov r10, r2
_08063EE0:
ldr r0, [sp, 0xC4]
adds r1, r7, 0
mov r2, sp
add r3, sp, 0xC0
bl sub_8064228
_08063EEC:
mov r0, r8
bl AddMenuCursorSprite
movs r0, 0x1E
bl DungeonRunFrameActions
mov r0, r10
ldrh r1, [r0, 0x4]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08063F2A
mov r1, r8
movs r2, 0x18
ldrsh r4, [r1, r2]
adds r0, r7, 0
adds r1, r4, 0
bl unk_FindMoveEnabledForAIAfter8
adds r1, r0, 0
mov r0, r8
bl sub_8013780
mov r1, r8
movs r2, 0x18
ldrsh r0, [r1, r2]
cmp r4, r0
beq _08063F2A
movs r0, 0
bl PlayDungeonCursorSE
_08063F2A:
mov r0, r10
ldrh r1, [r0, 0x4]
movs r0, 0x40
ands r0, r1
cmp r0, 0
beq _08063F5C
mov r1, r8
movs r2, 0x18
ldrsh r4, [r1, r2]
adds r0, r7, 0
adds r1, r4, 0
bl unk_FindMoveEnabledForAIBefore8
adds r1, r0, 0
mov r0, r8
bl sub_8013780
mov r1, r8
movs r2, 0x18
ldrsh r0, [r1, r2]
cmp r4, r0
beq _08063F5C
movs r0, 0
bl PlayDungeonCursorSE
_08063F5C:
bl sub_8062D88
mov r2, r10
ldrh r1, [r2, 0x2]
ands r0, r1
cmp r0, 0
bne _08063F76
ldr r2, _08063F84
adds r0, r2, 0
adds r0, 0x29
ldrb r0, [r0]
cmp r0, 0
beq _08063F8C
_08063F76:
bl PlayDungeonConfirmationSE
movs r4, 0
b _08063FB2
.align 2, 0
_08063F80: .4byte gUnknown_202F2D8
_08063F84: .4byte gDungeonMenu
_08063F88: .4byte gRealInputs
_08063F8C:
movs r0, 0x8
ands r0, r1
cmp r0, 0
bne _08063FD4
ldr r0, [sp, 0xCC]
cmp r0, 0
beq _08063EEC
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _08063FAC
adds r0, r2, 0
adds r0, 0x2A
ldrb r0, [r0]
cmp r0, 0
beq _08063EEC
_08063FAC:
bl PlayDungeonCancelSE
movs r4, 0x1
_08063FB2:
ldr r5, _08063FD0
adds r0, r5, 0
bl AddMenuCursorSprite
movs r0, 0x1E
bl DungeonRunFrameActions
cmp r4, 0x1
bne _08063FDC
movs r0, 0x1
negs r0, r0
mov r1, r9
str r0, [r1]
b _080640FA
.align 2, 0
_08063FD0: .4byte gDungeonMenu
_08063FD4:
bl PlayDungeonStartButtonSE
movs r4, 0x2
b _08063FB2
_08063FDC:
ldr r6, _08064004
movs r2, 0x18
ldrsh r0, [r5, r2]
str r0, [r6]
cmp r4, 0x2
bne _08064008
movs r0, 0
movs r1, 0
bl sub_803EAF0
movs r0, 0x8
movs r1, 0x1B
bl sub_803E708
ldr r1, [r6]
adds r0, r7, 0
movs r2, 0x4
bl sub_8063834
b _08063EE0
.align 2, 0
_08064004: .4byte gUnknown_202F2D8
_08064008:
adds r0, r7, 0
bl sub_8064310
mov r0, sp
movs r1, 0x16
bl CreateDungeonMenuSubWindow
adds r4, r5, 0
ldr r6, _0806408C
adds r5, 0x2A
_0806401C:
adds r0, r4, 0
bl AddMenuCursorSprite
movs r0, 0x1B
bl DungeonRunFrameActions
ldrh r1, [r6, 0x4]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08064040
movs r0, 0x1
bl PlayDungeonCursorSE
adds r0, r4, 0
movs r1, 0x1
bl MoveMenuCursorDownWrapAround
_08064040:
ldrh r1, [r6, 0x4]
movs r0, 0x40
ands r0, r1
cmp r0, 0
beq _08064058
movs r0, 0x1
bl PlayDungeonCursorSE
adds r0, r4, 0
movs r1, 0x1
bl MoveMenuCursorUpWrapAround
_08064058:
bl sub_8062D88
ldrh r1, [r6, 0x2]
ands r1, r0
cmp r1, 0
bne _0806406E
adds r0, r4, 0
adds r0, 0x29
ldrb r0, [r0]
cmp r0, 0
beq _0806409C
_0806406E:
movs r1, 0x18
ldrsh r0, [r4, r1]
bl CanSubMenuItemBeChosen
lsls r0, 24
cmp r0, 0
beq _08064098
movs r2, 0x18
ldrsh r0, [r4, r2]
cmp r0, 0x2
bne _08064090
bl PlayDungeonConfirmationSE
b _08064094
.align 2, 0
_0806408C: .4byte gRealInputs
_08064090:
bl sub_8083D1C
_08064094:
movs r4, 0
b _080640B2
_08064098:
bl PlayDungeonCancelSE
_0806409C:
ldrh r1, [r6, 0x2]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _080640AC
ldrb r0, [r5]
cmp r0, 0
beq _0806401C
_080640AC:
bl PlayDungeonCancelSE
movs r4, 0x1
_080640B2:
ldr r6, _080640E4
adds r0, r6, 0
bl AddMenuCursorSprite
movs r0, 0x1B
bl DungeonRunFrameActions
movs r0, 0
movs r1, 0
bl sub_803EAF0
cmp r4, 0x1
bne _080640CE
b _08063EE0
_080640CE:
movs r1, 0x18
ldrsh r0, [r6, r1]
cmp r0, 0x1
bne _080640E8
mov r2, r9
ldr r1, [r2]
adds r0, r7, 0
bl sub_8063E30
b _08063EE0
.align 2, 0
_080640E4: .4byte gDungeonMenu
_080640E8:
cmp r0, 0x2
bne _080640FA
mov r0, r9
ldr r1, [r0]
adds r0, r7, 0
movs r2, 0x8
bl sub_8063834
b _08063EE0
_080640FA:
ldr r1, _08064140
ldr r2, [r1]
cmp r2, 0
bge _08064104
b _08064214
_08064104:
ldr r0, [sp, 0xC8]
cmp r0, 0
beq _08064160
movs r4, 0
lsls r0, r2, 3
adds r1, r7, r0
adds r0, r2, 0x1
cmp r0, 0x7
bgt _08064130
lsls r0, 3
adds r0, r7
ldrb r2, [r0]
movs r0, 0x1
ands r0, r2
cmp r0, 0
beq _08064130
movs r0, 0x2
ands r0, r2
lsls r0, 24
lsrs r0, 24
negs r0, r0
lsrs r4, r0, 31
_08064130:
ldr r0, _08064144
movs r2, 0
bl BufferMoveName
cmp r4, 0
beq _0806414C
ldr r0, _08064148
b _0806414E
.align 2, 0
_08064140: .4byte gUnknown_202F2D8
_08064144: .4byte gFormatBuffer_Items
_08064148: .4byte gUnknown_80FDF00
_0806414C:
ldr r0, _0806415C
_0806414E:
ldr r1, [r0]
movs r0, 0
movs r2, 0
bl DisplayDungeonYesNoMessage
adds r3, r0, 0
b _08064162
.align 2, 0
_0806415C: .4byte gUnknown_80FDF70
_08064160:
movs r3, 0x1
_08064162:
cmp r3, 0x1
beq _08064168
b _08063EE0
_08064168:
mov r1, r9
ldr r0, [r1]
lsls r0, 3
adds r0, r7
movs r1, 0
strb r1, [r0]
mov r2, r9
ldr r0, [r2]
adds r2, r0, 0x1
cmp r2, 0x7
bgt _080641BC
lsls r0, r2, 3
adds r4, r7, r0
ldrb r1, [r4]
ands r3, r1
cmp r3, 0
beq _080641BC
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _080641BC
movs r0, 0
mov r12, r0
movs r6, 0x1
adds r3, r4, 0
movs r5, 0x2
_0806419C:
mov r1, r12
strb r1, [r4]
adds r3, 0x8
adds r2, 0x1
cmp r2, 0x7
bgt _080641BC
adds r4, r3, 0
ldrb r1, [r3]
adds r0, r6, 0
ands r0, r1
cmp r0, 0
beq _080641BC
adds r0, r5, 0
ands r0, r1
cmp r0, 0
bne _0806419C
_080641BC:
movs r4, 0
movs r6, 0x1
adds r3, r7, 0
add r5, sp, 0x60
movs r2, 0x7
_080641C6:
ldrb r1, [r3]
adds r0, r6, 0
ands r0, r1
cmp r0, 0
beq _080641D8
ldr r0, [r3]
ldr r1, [r3, 0x4]
stm r5!, {r0,r1}
adds r4, 0x1
_080641D8:
adds r3, 0x8
subs r2, 0x1
cmp r2, 0
bge _080641C6
cmp r4, 0x7
bgt _080641F4
movs r1, 0
_080641E6:
lsls r0, r4, 3
add r0, sp
adds r0, 0x60
strb r1, [r0]
adds r4, 0x1
cmp r4, 0x7
ble _080641E6
_080641F4:
add r4, sp, 0x60
adds r3, r7, 0
movs r2, 0x7
_080641FA:
ldm r4!, {r0,r1}
stm r3!, {r0,r1}
subs r2, 0x1
cmp r2, 0
bge _080641FA
ldr r2, _08064210
ldr r0, [r2]
cmp r0, 0
blt _08064214
movs r0, 0x1
b _08064216
.align 2, 0
_08064210: .4byte gUnknown_202F2D8
_08064214:
movs r0, 0
_08064216:
add sp, 0xD0
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8063E70
thumb_func_start sub_8064228
sub_8064228:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r9, r0
mov r10, r1
adds r5, r2, 0
adds r7, r3, 0
movs r1, 0
movs r0, 0x1
strb r0, [r7]
strb r1, [r7, 0x1]
strb r1, [r7, 0x3]
mov r8, r1
ldr r6, _08064304
ldr r0, _08064308
mov r12, r0
movs r4, 0x1
mov r2, r10
movs r3, 0x7
_08064254:
ldrb r1, [r2]
adds r0, r4, 0
ands r0, r1
cmp r0, 0
beq _08064262
movs r1, 0x1
add r8, r1
_08064262:
adds r2, 0x8
subs r3, 0x1
cmp r3, 0
bge _08064254
mov r2, r12
ldr r0, [r2]
movs r4, 0
strh r0, [r6, 0x18]
mov r3, r8
strh r3, [r6, 0x1A]
strh r3, [r6, 0x1C]
strh r4, [r6, 0x1E]
strh r4, [r6, 0x20]
strh r4, [r6, 0x4]
movs r0, 0x10
strh r0, [r6, 0x6]
strh r4, [r6, 0xC]
strh r4, [r6, 0xE]
strh r4, [r6, 0x14]
str r4, [r6]
adds r0, r6, 0
adds r0, 0x28
bl sub_801317C
mov r0, r8
movs r1, 0xC
bl sub_80095E4
adds r0, 0x2
strh r0, [r5, 0x10]
strh r0, [r5, 0xE]
movs r0, 0xE
strb r0, [r7, 0x2]
movs r0, 0x2
strh r0, [r5, 0x8]
adds r1, r5, 0
adds r1, 0x18
adds r0, r5, 0
adds r0, 0x48
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
adds r1, r5, 0
adds r1, 0x30
adds r0, r5, 0
adds r0, 0x48
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
adds r0, r5, 0
movs r1, 0x1
bl DungeonShowWindows
adds r0, r6, 0
movs r1, 0
bl sub_80137B0
ldr r0, _0806430C
mov r7, r9
ldr r1, [r7, 0x70]
movs r2, 0
bl SetMessageArgument_2
str r4, [sp]
str r4, [sp, 0x4]
mov r0, r8
mov r1, r9
mov r2, r10
movs r3, 0
bl sub_8063578
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08064304: .4byte gDungeonMenu
_08064308: .4byte gUnknown_202F2D8
_0806430C: .4byte gFormatBuffer_Monsters
thumb_func_end sub_8064228
thumb_func_start sub_8064310
sub_8064310:

View File

@@ -4,28 +4,6 @@
@ CreateFieldItemMenu - sub_8062CA8
.global gUnknown_8106CAC
gUnknown_8106CAC: @ 8106CAC
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x0E, 0x00
.byte 0x1A, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_8106CC4
gUnknown_8106CC4: @ 8106CC4
.string "{MOVE_ITEM_0}\0"
.align 2,0
.global gUnknown_8106CC8
gUnknown_8106CC8: @ 8106CC8
.byte 0x01, 0x00, 0x10, 0x00
.global gUnknown_8106CCC
gUnknown_8106CCC: @ 8106CCC
.string "{POKEMON_0}\0"
@ ???
.align 2,0
.string "pksdir0\0"

View File

@@ -61,15 +61,13 @@ extern s32 gUnknown_202F2D8;
extern s32 sub_8044FB4(u16 param_1);
extern const u8 *const gUnknown_80FE978;
extern const WindowTemplate gUnknown_8106CAC;
extern const u8 *const gUnknown_80FDFE8;
extern const u8 gUnknown_8106CC4[];
void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7);
void sub_8063698(Entity *entity, u8 a1, u8 a2);
void sub_80637BC(ActionContainer *a0, s32 a1, s32 a2);
void sub_80637A4(ActionContainer *a0, s32 a1);
void sub_8063578(s32 a0, Entity *entity, Moves *moves, s32 a3, u8 a4, s32 a5);
void sub_8063578(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5);
bool8 sub_8063C88(EntityInfo *entInfo, s32 a1);
bool8 sub_8063DD4(EntityInfo *entInfo, s32 a1);
void sub_8063834(Move *moves, s32 a1, s32 a2);
@@ -427,7 +425,15 @@ bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4)
void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7)
{
s32 i, movesCount;
WindowTemplate windowNew = gUnknown_8106CAC;
WindowTemplate windowNew = {
.type = WINDOW_TYPE_NORMAL,
.pos = {2, 14},
.width = 26,
.height = 3,
.unk10 = 3,
.unk12 = 0,
.header = NULL,
};
header->count = arg7;
header->currId = arg6;
@@ -476,13 +482,13 @@ void sub_80633E4(Entity *entity, EntityInfo *entInfo, u8 a2, WindowTemplates *wi
}
}
sub_8063578(4, entity, &entInfo->moves, 0, a2, arg6);
sub_8063578(4, entity, entInfo->moves.moves, 0, a2, arg6);
sub_80073B8(2);
PrintFormattedStringOnWindow(4, 0, gUnknown_80FDFE8, 2, '\0');
sub_80073E0(2);
}
void sub_8063578(s32 count, Entity *entity, Moves *moves, s32 windowId, u8 a4, s32 a5)
void sub_8063578(s32 count, Entity *entity, Move *moves, s32 windowId, u8 a4, s32 a5)
{
s32 i;
EntityInfo *entInfo = GetEntInfo(entity);
@@ -493,7 +499,7 @@ void sub_8063578(s32 count, Entity *entity, Moves *moves, s32 windowId, u8 a4, s
for (i = 0; i < count; i++) {
s32 x, y;
unkStruct_80928C0 movStruct = {0, 106, 0, a4};
Move *move = &moves->moves[i];
Move *move = &moves[i];
if (MoveFlagExists(move)) {
if (entInfo->isTeamLeader) {
@@ -515,7 +521,7 @@ void sub_8063578(s32 count, Entity *entity, Moves *moves, s32 windowId, u8 a4, s
sub_80078A4(windowId, 12, y - 2, 120, 7);
}
}
PrintFormattedStringOnWindow(x, y, gUnknown_8106CC4, windowId, '\0');
PrintFormattedStringOnWindow(x, y, _("{MOVE_ITEM_0}"), windowId, '\0');
}
}
@@ -703,18 +709,21 @@ void sub_8063834(Move *moves, s32 a1, s32 a2)
}
extern WindowTemplates gUnknown_202F278;
extern const WindowHeader gUnknown_8106CC8;
extern const u8 gUnknown_8106CCC[];
static const WindowHeader sStatusDescriptionHeader = {
.count = 1,
.width = 16,
};
void ShowStatusDescriptionMenu(struct subStruct_203B240 *status, MenuInputStructSub *menuSub)
{
sub_80140B4(&gUnknown_202F278);
gUnknown_202F278.id[0].header = &gUnknown_8106CC8;
gUnknown_202F278.id[0].header = &sStatusDescriptionHeader;
DungeonShowWindows(&gUnknown_202F278, TRUE);
sub_80073B8(0);
strcpy(gFormatBuffer_Monsters[0], status->pokeName);
PrintFormattedStringOnWindow(16, 0, gUnknown_8106CCC, 0, '\0');
PrintFormattedStringOnWindow(16, 0, _("{POKEMON_0}"), 0, '\0');
PrintFormattedStringOnWindow(4, 16, status->unk4, 0, '\0');
sub_80073E0(0);
gDungeonMenu.unk1E = 0;
@@ -917,4 +926,244 @@ void sub_8063E30(Move *moves, s32 id)
unk_FixLinkedMovesSetEnabled8(moves);
}
extern void sub_8083D1C(void);
void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header);
void sub_8064310(Move *moves);
extern const u8 *const gUnknown_80FDF70;
extern const u8 *const gUnknown_80FDF00;
static inline void ResetMoveFlags(Move *move)
{
move->moveFlags = 0;
}
bool8 sub_8063E70(Entity *entity, Move *moves, bool8 showYesNoBox, bool8 allowBPress)
{
s32 i, count;
WindowHeader header;
WindowTemplates windows = {
.id = {
[0] = {
.type = WINDOW_TYPE_WITH_HEADER,
.pos = {2, 2},
.width = 18,
.height = 16,
.unk10 = 16,
.unk12 = 0,
.header = &header,
},
[1] = WINDOW_DUMMY,
[2] = WINDOW_DUMMY,
[3] = WINDOW_DUMMY,
}
};
Move movesLocal[8];
gUnknown_202F2D8 = 0;
while (1) {
s32 inputAction;
s32 yesNoAnswer;
sub_8064228(entity, moves, &windows, &header);
while (1) {
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x1E);
if (gRealInputs.repeated & DPAD_DOWN) {
s32 prev = gDungeonMenu.menuIndex;
sub_8013780(&gDungeonMenu, unk_FindMoveEnabledForAIAfter8(moves, prev));
if (prev != gDungeonMenu.menuIndex) {
PlayDungeonCursorSE(FALSE);
}
}
if (gRealInputs.repeated & DPAD_UP) {
s32 prev = gDungeonMenu.menuIndex;
sub_8013780(&gDungeonMenu, unk_FindMoveEnabledForAIBefore8(moves, prev));
if (prev != gDungeonMenu.menuIndex) {
PlayDungeonCursorSE(FALSE);
}
}
ASM_MATCH_TRICK(gUnknown_202F2D8);
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
inputAction = 0;
break;
}
if (gRealInputs.pressed & START_BUTTON) {
PlayDungeonStartButtonSE();
inputAction = 2;
break;
}
if (allowBPress && (CheckPressed(B_BUTTON) || gDungeonMenu.unk28.b_button)) {
PlayDungeonCancelSE();
inputAction = 1;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x1E);
if (inputAction == 1) {
gUnknown_202F2D8 = -1;
}
else {
gUnknown_202F2D8 = gDungeonMenu.menuIndex;
if (inputAction == 2) {
sub_803EAF0(0, 0);
sub_803E708(8, 0x1B);
ASM_MATCH_TRICK(gUnknown_202F2D8);
sub_8063834(moves, gUnknown_202F2D8, 4);
continue;
}
sub_8064310(moves);
CreateDungeonMenuSubWindow(&windows.id[0], 22);
while (1) {
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x1B);
if (gRealInputs.repeated & DPAD_DOWN) {
PlayDungeonCursorSE(TRUE);
MoveMenuCursorDownWrapAround(&gDungeonMenu, TRUE);
}
if (gRealInputs.repeated & DPAD_UP) {
PlayDungeonCursorSE(TRUE);
MoveMenuCursorUpWrapAround(&gDungeonMenu, TRUE);
}
if ((gRealInputs.pressed & sub_8062D88()) || gDungeonMenu.unk28.a_button) {
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
if (gDungeonMenu.menuIndex == 2) {
PlayDungeonConfirmationSE();
}
else {
sub_8083D1C();
}
inputAction = 0;
break;
}
PlayDungeonCancelSE();
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
inputAction = 1;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x1b);
sub_803EAF0(0, 0);
if (inputAction == 1)
continue;
if (gDungeonMenu.menuIndex == 1) {
sub_8063E30(moves, gUnknown_202F2D8);
continue;
}
if (gDungeonMenu.menuIndex == 2) {
sub_8063834(moves, gUnknown_202F2D8, 8);
continue;
}
}
if (gUnknown_202F2D8 < 0)
break;
if (showYesNoBox) {
bool8 linked = FALSE;
Move *move = &moves[gUnknown_202F2D8];
s32 nextMoveId = gUnknown_202F2D8 + 1;
if (nextMoveId < 8 && MoveFlagExists(&moves[nextMoveId])) {
linked = MoveFlagLinkChain(&moves[nextMoveId]) != 0;
}
BufferMoveName(gFormatBuffer_Items[0], move, NULL);
yesNoAnswer = DisplayDungeonYesNoMessage(NULL, (!linked) ? gUnknown_80FDF70 : gUnknown_80FDF00, FALSE);
}
else {
yesNoAnswer = 1;
}
if (yesNoAnswer == 1) {
moves[gUnknown_202F2D8].moveFlags = 0;
for (i = gUnknown_202F2D8 + 1; i < 8; i++) {
Move *move = &moves[i];
if (!MoveFlagExists(move))
break;
if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))
break;
ResetMoveFlags(move);
}
count = 0;
for (i = 0; i < 8; i++) {
Move *move = &moves[i];
if (MoveFlagExists(move)) {
movesLocal[count++] = *move;
}
}
for (; count < 8; count++) {
ResetMoveFlags(&movesLocal[count]);
}
for (i = 0; i < 8; i++) {
moves[i] = movesLocal[i];
}
break;
}
}
if (gUnknown_202F2D8 < 0)
return FALSE;
return TRUE;
}
void sub_8064228(Entity *entity, Move *moves, WindowTemplates *windows, WindowHeader *header)
{
s32 i, count;
header->count = 1;
header->currId = 0;
header->f3 = 0;
count = 0;
for (i = 0; i < 8; i++) {
if (MoveFlagExists(&moves[i])) {
count++;
}
}
gDungeonMenu.menuIndex = gUnknown_202F2D8;
gDungeonMenu.unk1A = count;
gDungeonMenu.unk1C = count;
gDungeonMenu.unk1E = 0;
gDungeonMenu.unk20 = 0;
gDungeonMenu.unk4 = 0;
gDungeonMenu.firstEntryY = 16;
gDungeonMenu.unkC = 0;
gDungeonMenu.unkE = 0;
gDungeonMenu.unk14.x = 0;
gDungeonMenu.unk0 = 0;
sub_801317C(&gDungeonMenu.unk28);
windows->id[0].height = windows->id[0].unk10 = sub_80095E4(count, 12) + 2;
header->width = 14;
windows->id[0].pos.x = 2;
windows->id[1] = windows->id[3];
windows->id[2] = windows->id[3];
DungeonShowWindows(windows, TRUE);
sub_80137B0(&gDungeonMenu, 0);
SetMessageArgument_2(gFormatBuffer_Monsters[0], GetEntInfo(entity), 0);
sub_8063578(count, entity, moves, 0, 0, 0);
}
//