sub_805FC30

This commit is contained in:
DizzyEggg 2024-07-23 12:11:32 +02:00
parent f3626e764c
commit 4d6fed883e
4 changed files with 110 additions and 185 deletions

View File

@ -6,167 +6,6 @@
.text
thumb_func_start sub_805FBE8
sub_805FBE8:
push {r4,r5,lr}
adds r5, r0, 0
movs r0, 0x8
adds r1, r5, 0
bl sub_803EAF0
_0805FBF4:
movs r0, 0xE
bl sub_803E46C
bl xxx_draw_string_80144C4
bl sub_8016080
adds r4, r0, 0
cmp r4, 0
beq _0805FBF4
bl CleanConfirmNameMenu
movs r0, 0xE
bl sub_803E46C
movs r0, 0
movs r1, 0
bl sub_803EAF0
cmp r4, 0x3
bne _0805FC28
ldrb r0, [r5]
cmp r0, 0
beq _0805FC28
movs r0, 0x1
b _0805FC2A
_0805FC28:
movs r0, 0
_0805FC2A:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_805FBE8
thumb_func_start sub_805FC30
sub_805FC30:
push {r4-r6,lr}
sub sp, 0x78
adds r4, r0, 0
adds r6, r1, 0
add r5, sp, 0x4
adds r0, r5, 0
movs r1, 0
movs r2, 0x60
bl memset
movs r3, 0x3
str r3, [sp, 0x8]
str r3, [sp, 0x20]
movs r2, 0
movs r0, 0x16
strh r0, [r5, 0x20]
movs r1, 0x4
strh r1, [r5, 0x22]
movs r0, 0x6
strh r0, [r5, 0x24]
strh r1, [r5, 0x26]
strh r1, [r5, 0x28]
str r3, [sp, 0x38]
str r3, [sp, 0x50]
add r0, sp, 0x4
ldm r4!, {r1,r3,r5}
stm r0!, {r1,r3,r5}
ldm r4!, {r1,r3,r5}
stm r0!, {r1,r3,r5}
add r1, sp, 0x4
movs r0, 0x80
strb r0, [r1]
ldr r4, _0805FD30
strh r2, [r4, 0x18]
ldr r5, _0805FD34
ldr r0, [r5]
strh r0, [r4, 0x1C]
strh r0, [r4, 0x1A]
strh r2, [r4, 0x1E]
strh r2, [r4, 0x20]
strh r2, [r4, 0x4]
strh r2, [r4, 0x6]
movs r0, 0x1
str r0, [r4]
strh r2, [r4, 0xC]
strh r2, [r4, 0xE]
ldr r0, [r4, 0x8]
str r0, [r4, 0x14]
adds r0, r4, 0
adds r0, 0x28
bl sub_801317C
add r0, sp, 0x4
strh r6, [r0, 0x20]
adds r1, r0, 0
movs r0, 0x1C
subs r0, r6
strh r0, [r1, 0x24]
movs r1, 0x1C
ldrsh r0, [r4, r1]
movs r1, 0
bl sub_80095E4
add r2, sp, 0x4
adds r1, r2, 0
strh r0, [r1, 0x28]
strh r0, [r2, 0x26]
adds r0, r1, 0
movs r1, 0
bl sub_803ECB4
add r0, sp, 0x4
movs r2, 0x26
ldrsh r1, [r0, r2]
lsls r1, 3
adds r0, r4, 0
bl sub_80137B0
movs r0, 0x1
bl sub_80073B8
movs r6, 0
ldr r0, [r5]
cmp r6, r0
bge _0805FD20
add r5, sp, 0x64
_0805FCDC:
adds r0, r6, 0
bl sub_8044F3C
lsls r0, 24
movs r4, 0x2
cmp r0, 0
beq _0805FCEC
movs r4, 0x7
_0805FCEC:
adds r0, r6, 0
bl sub_8044EC8
adds r3, r0, 0
adds r0, r5, 0
ldr r1, _0805FD38
adds r2, r4, 0
bl sprintfStatic
ldr r0, _0805FD30
adds r1, r6, 0
bl sub_8013800
adds r1, r0, 0
movs r0, 0
str r0, [sp]
movs r0, 0x8
adds r2, r5, 0
movs r3, 0x1
bl xxx_call_draw_string
adds r6, 0x1
ldr r0, _0805FD34
ldr r0, [r0]
cmp r6, r0
blt _0805FCDC
_0805FD20:
movs r0, 0x1
bl sub_80073E0
add sp, 0x78
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_0805FD30: .4byte gUnknown_202EE10
_0805FD34: .4byte gUnknown_202EE6C
_0805FD38: .4byte gUnknown_8106B50
thumb_func_end sub_805FC30
thumb_func_start sub_805FD3C
sub_805FD3C:

View File

@ -3,6 +3,7 @@
#include "sprite_oam.h"
#include "structs/str_text.h"
#include "structs/str_position.h"
// size: 0xC
typedef struct MenuInputStructSub
@ -23,13 +24,11 @@ typedef struct MenuInputStruct
s32 unk0;
u16 unk4;
s16 unk6;
s16 unk8; // Maybe Position
s16 unkA;
Position unk8; // Maybe Position
s16 unkC; // Maybe Position
s16 unkE;
u32 unk10;
s16 unk14; // Maybe Position
s16 unk16;
Position unk14; // Maybe Position
/* 0x18 */ s16 menuIndex;
s16 unk1A;
s16 unk1C;
@ -81,4 +80,4 @@ typedef struct unkStructFor8013AA0
SpriteOAM unk28;
} unkStructFor8013AA0;
#endif // GUARD_MENU_H
#endif // GUARD_MENU_H

View File

@ -12,6 +12,9 @@
#include "pokemon.h"
#include "code_8045A00.h"
#include "code_80130A8.h"
#include "code_803E46C.h"
#include "code_801602C.h"
#include "code_800D090.h"
#include "trap.h"
#include "charge_move.h"
#include "dungeon_map_access.h"
@ -28,12 +31,15 @@
#include "items.h"
#include "play_time.h"
#include "text2.h"
#include "text1.h"
#include "code_806CD90.h"
#include "dungeon_capabilities.h"
#include "constants/dungeon.h"
#include "constants/status.h"
#include "constants/iq_skill.h"
#include "constants/dungeon_action.h"
#include "structs/struct_sub80095e4.h"
#include "structs/str_text.h"
struct UnkMenuBitsStruct {
u8 a0_8;
@ -83,7 +89,6 @@ void sub_8044C50(u16 a0);
void sub_805E2C4(Entity *leader);
bool8 sub_8094C48(void);
void sub_8052210(u8 a0);
void sub_803E46C(s32 a0);
bool8 sub_805EC4C(Entity *a0, u8 a1);
void sub_803E724(s32 a0);
void HandleTalkFieldAction(Entity *);
@ -2777,7 +2782,7 @@ void sub_805EFB4(Entity *a0, bool8 a1)
}
}
extern void sub_803EAF0(u32, u32);
extern void sub_803EAF0(u32, u8 *);
extern void sub_803F508(Entity *);
extern void sub_8041AD0(Entity *pokemon);
extern void sub_8041AE0(Entity *pokemon);
@ -3223,7 +3228,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1)
}
}
sub_803EAF0(0, 0);
sub_803EAF0(0, NULL);
ResetRepeatTimers();
ResetUnusedInputStruct();
}
@ -3257,14 +3262,14 @@ void DrawFieldMenu(u8 a0)
gUnknown_202EE10.unkC = 0;
gUnknown_202EE10.unkE = 0;
gUnknown_202EE10.unk0 = 0;
gUnknown_202EE10.unk14 = 0;
gUnknown_202EE10.unk14.x = 0;
sub_801317C(&gUnknown_202EE10.unk28);
sub_80137B0(&gUnknown_202EE10, 0x38);
if (a0) {
sub_803EAF0(7, 0);
sub_803EAF0(7, NULL);
}
else {
sub_803EAF0(6, 0);
sub_803EAF0(6, NULL);
}
sub_80073B8(0);
@ -3343,3 +3348,85 @@ void DrawFieldMenu(u8 a0)
}
}
bool8 sub_805FBE8(u8 *a0)
{
s32 r4;
sub_803EAF0(8, a0);
do
{
sub_803E46C(0xE);
xxx_draw_string_80144C4();
r4 = sub_8016080();
} while (r4 == 0);
CleanConfirmNameMenu();
sub_803E46C(0xE);
sub_803EAF0(0, NULL);
if (r4 == 3 && *a0 != 0)
return TRUE;
return FALSE;
}
extern u8 *sub_8044EC8(s32 param_1);
extern bool8 sub_8044F3C(s32 param_1);
extern s32 gUnknown_202EE6C;
extern const u8 gUnknown_8106B50[];
extern void sub_803ECB4(struct UnkTextStruct2 *a0, u8 a1);
// Inline needed to match.
static inline void SetUpTxtStructs(struct UnkTextStruct2 *sp, struct UnkTextStruct2 *a0, u32 size)
{
memset(sp, 0, size);
sp[0].unk4 = 3;
sp[1].unk4 = 3;
sp[1].unk8.unk0.separate.unk0 = 0x16;
sp[1].unk8.unk0.separate.unk2 = 4;
sp[1].unkC = 6;
sp[1].unkE = 4;
sp[1].unk10 = 4;
sp[2].unk4 = 3;
sp[3].unk4 = 3;
}
void sub_805FC30(struct UnkTextStruct2 *a0, s32 a1)
{
s32 i;
struct UnkTextStruct2 sp[4];
SetUpTxtStructs(sp, a0, sizeof(sp));
sp[0] = a0[0];
sp[0].unk0 = 0x80;
gUnknown_202EE10.menuIndex = 0;
gUnknown_202EE10.unk1C = gUnknown_202EE6C;
gUnknown_202EE10.unk1A = gUnknown_202EE6C;
gUnknown_202EE10.unk1E = 0;
gUnknown_202EE10.unk20 = 0;
gUnknown_202EE10.unk4 = 0;
gUnknown_202EE10.unk6 = 0;
gUnknown_202EE10.unk0 = 1;
gUnknown_202EE10.unkC = 0;
gUnknown_202EE10.unkE = 0;
gUnknown_202EE10.unk14 = gUnknown_202EE10.unk8;
sub_801317C(&gUnknown_202EE10.unk28);
sp[1].unk8.unk0.separate.unk0 = a1;
sp[1].unkC = 28 - a1;
sp[1].unkE = sp[1].unk10 = sub_80095E4(gUnknown_202EE10.unk1C, 0);
sub_803ECB4(sp, 0);
sub_80137B0(&gUnknown_202EE10, sp[1].unkE * 8);
sub_80073B8(1);
for (i = 0; i < gUnknown_202EE6C; i++) {
s32 r4, y;
u8 text[20];
r4 = (sub_8044F3C(i) != 0) ? 7 : 2;
sprintfStatic(text, gUnknown_8106B50, r4, sub_8044EC8(i));
y = sub_8013800(&gUnknown_202EE10, i);
xxx_call_draw_string(8, y, text, 1, 0);
}
sub_80073E0(1);
}

View File

@ -66,7 +66,7 @@ const s32 gUnknown_80D4830[9] = {
extern s16 sub_8009614(u32, u32);
static void sub_8013134(MenuInputStruct *, u32, u32);
static void sub_801332C(s16 *);
static void sub_801332C(Position *a0);
static void sub_8013470(MenuInputStruct *);
static bool8 sub_8013DD0(unkStructFor8013AA0 *);
@ -607,7 +607,7 @@ static void sub_8013134(MenuInputStruct *param_1, u32 menuItemCounter, u32 index
param_1->unkC = 0;
param_1->unkE = 0;
param_1->unk14 = 0;
param_1->unk14.x = 0;
param_1->unk24 = 0;
sub_801317C(&param_1->unk28);
}
@ -691,11 +691,11 @@ void AddMenuCursorSprite_(MenuInputStruct *a0, u8 *a1)
ptr->unk6 &= ~SPRITEOAM_MASK_UNK6_0;
ptr->unk6 &= ~SPRITEOAM_MASK_UNK6_1;
r0 = a0->unk8;
r0 = a0->unk8.x;
r0 &= SPRITEOAM_MAX_X;
ptr->attrib2 = r0;
value = a0->unkA + 1;
value = a0->unk8.y + 1;
value &= SPRITEOAM_MAX_UNK6_4;
value <<= SPRITEOAM_SHIFT_UNK6_4;
ptr->unk6 &= r5;
@ -706,7 +706,7 @@ void AddMenuCursorSprite_(MenuInputStruct *a0, u8 *a1)
}
sub_8013470(a0);
if (a0->unk14 != 0)
if (a0->unk14.x != 0)
sub_801332C(&a0->unk14);
a0->unk24++;
@ -717,7 +717,7 @@ void nullsub_34(MenuInputStructSub *a0)
}
// Maybe Position
static void sub_801332C(s16 *a0)
static void sub_801332C(Position *a0)
{
SpriteOAM sp = {};
SpriteOAM* ptr;
@ -774,11 +774,11 @@ static void sub_801332C(s16 *a0)
ptr->unk6 &= ~SPRITEOAM_MASK_UNK6_0;
ptr->unk6 &= ~SPRITEOAM_MASK_UNK6_1;
r1 = a0[0];
r1 = a0->x;
r1 &= SPRITEOAM_MAX_X;
ptr->attrib2 = r1;
r0 = a0[1] + 1;
r0 = a0->y + 1;
r0 &= SPRITEOAM_MAX_UNK6_4;
r0 <<= SPRITEOAM_SHIFT_UNK6_4;
ptr->unk6 &= r6;
@ -931,8 +931,8 @@ void UpdateMenuCursorSpriteCoords(MenuInputStruct *param_1)
index = param_1->unk0;
temp = &gUnknown_2027370[index];
param_1->unk8 = temp->unk0 * 8 + param_1->unk4;
param_1->unkA = temp->unk2 * 8 + sub_8013800(param_1, param_1->menuIndex);
param_1->unk8.x = temp->unk0 * 8 + param_1->unk4;
param_1->unk8.y = temp->unk2 * 8 + sub_8013800(param_1, param_1->menuIndex);
}
void MoveMenuCursorDown(MenuInputStruct *param_1)
@ -1061,7 +1061,7 @@ void sub_8013818(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4
param_1->unk0 = param_4;
param_1->unk22 = param_2;
param_1->unk1C = param_3;
param_1->unk14 = 0;
param_1->unk14.x = 0;
param_1->unk24 = 0;
param_1->menuIndex = 0;
param_1->unk1E = 0;
@ -1076,7 +1076,7 @@ void sub_8013848(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4
param_1->unk0 = param_4;
param_1->unk22 = param_2;
param_1->unk1C = param_3;
param_1->unk14 = 0;
param_1->unk14.x = 0;
param_1->unk24 = 0;
param_1->menuIndex = 0;
param_1->unk1E = 0;
@ -1142,7 +1142,7 @@ bool8 sub_8013938(MenuInputStruct *param_1)
sVar1 = param_1->unk1E;
param_1->unk1A = 0;
param_1->unk14 = 0;
param_1->unk14.x = 0;
AddMenuCursorSprite(param_1);
switch (GetKeyPress(param_1)) {