start moving more structs to use UnkInputStruct

This commit is contained in:
Seth Barberee 2023-06-26 20:24:47 -07:00
parent 40772e3a2f
commit 852f4b9eff
14 changed files with 269 additions and 352 deletions

View File

@ -5,79 +5,6 @@
.text
thumb_func_start sub_8013134
sub_8013134:
push {r4,lr}
adds r4, r0, 0
lsls r0, r2, 3
adds r0, r2
lsls r0, 3
ldr r3, _0801315C
adds r0, r3
str r2, [r4]
movs r2, 0
strh r2, [r4, 0x18]
strh r1, [r4, 0x1A]
strh r1, [r4, 0x1C]
strh r2, [r4, 0x1E]
strh r2, [r4, 0x4]
ldr r0, [r0, 0xC]
cmp r0, 0x6
bne _08013160
movs r0, 0x10
b _08013162
.align 2, 0
_0801315C: .4byte gUnknown_2027370
_08013160:
movs r0, 0x2
_08013162:
strh r0, [r4, 0x6]
movs r0, 0
strh r0, [r4, 0xC]
strh r0, [r4, 0xE]
strh r0, [r4, 0x14]
strh r0, [r4, 0x24]
adds r0, r4, 0
adds r0, 0x28
bl sub_801317C
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8013134
thumb_func_start sub_801317C
sub_801317C:
push {lr}
movs r1, 0
strb r1, [r0]
strb r1, [r0, 0x1]
strb r1, [r0, 0x2]
strb r1, [r0, 0x4]
strb r1, [r0, 0x3]
ldr r1, _080131A4
strh r1, [r0, 0x8]
movs r1, 0x1
negs r1, r1
strh r1, [r0, 0xA]
adds r0, 0x8
bl nullsub_7
bl ResetUnusedInputStruct
pop {r0}
bx r0
.align 2, 0
_080131A4: .4byte 0x0000ffff
thumb_func_end sub_801317C
thumb_func_start AddMenuCursorSprite
AddMenuCursorSprite:
push {lr}
movs r1, 0
bl AddMenuCursorSprite_
pop {r0}
bx r0
thumb_func_end AddMenuCursorSprite
thumb_func_start AddMenuCursorSprite_
AddMenuCursorSprite_:
push {r4-r6,lr}

View File

@ -48,26 +48,39 @@ struct UnusedInputStruct
/* 0x2A..0x2B - padding */
};
struct UnkInputStructSub
{
u8 unk0;
/* 0x1 */ u8 a_button;
/* 0x2 */ u8 b_button;
/* 0x3 */ u8 dpad_right;
/* 0x4 */ u8 dpad_left;
u8 fill5[3];
u16 unk8;
s16 unkA;
};
struct UnkInputStruct
{
/* 0x0 */ u8 unk0;
/* 0x1 */ u8 unk1;
/* 0x2 */ u8 unk2;
/* 0x3 */ u8 unk3;
/* 0x4 */ u8 unk4;
/* 0x8 */ u32 unk8;
/* 0xC */ u32 unkC;
s32 unk0;
/* 0x4 */ u16 unk4;
/* 0x6 */ u16 unk6;
/* 0x8 */ u16 unk8;
/* 0x8 */ u16 unkA;
/* 0xC */ u16 unkC;
/* 0xE */ u16 unkE;
/* 0x10 */ u32 unk10;
/* 0x14 */ u32 unk14;
/* 0x18 */ u32 unk18;
/* 0x1C */ u32 unk1C;
/* 0x20 */ u32 unk20;
/* 0x24 */ u32 unk24;
/* 0x28 */ u8 unk28;
/* 0x29 */ u8 a_button;
/* 0x2A */ u8 b_button;
/* 0x2B */ u8 dpad_right;
/* 0x2C */ u8 dpad_left;
/* 0x14 */ u16 unk14;
/* 0x16 */ u16 unk16;
/* 0x18 */ s16 menuIndex;
/* 0x1A */ s16 unk1A;
/* 0x1C */ s16 unk1C;
/* 0x1E */ s16 unk1E;
/* 0x20 */ u16 unk20;
/* 0x20 */ u16 unk22;
/* 0x24 */ u16 unk24;
u16 unk26;
/* 0x28 */ struct UnkInputStructSub unk28;
};

View File

@ -41,17 +41,8 @@ struct unkStruct_203B224
{
// size: 0xF4
u32 unk0;
u32 unk4[INVENTORY_SIZE];
u32 unk54;
u8 fill58[0x6C - 0x58];
s16 unk6C;
s16 unk6E;
s16 unk70;
s16 unk72;
u16 unk74;
u16 unk76;
u8 fill78[0x88 - 0x78];
/* 0x54 */ struct UnkInputStruct input;
u32 unk88;
struct UnkTextStruct2 *unk8C;
struct UnkTextStruct2 unk90[4];

View File

@ -1,6 +1,8 @@
#ifndef GUARD_MENU_H
#define GUARD_MENU_H
#include "input.h"
struct MenuItem
{
const u8 *text;
@ -15,13 +17,7 @@ struct MenuStruct
const u32 *menuTextColorArray;
u16 *unkC;
/* 0x10 */ s32 index;
/* 0x14 */ u32 unk14;
u8 fill18[0x2C - 0x18];
/* 0x2C */ s16 menuIndex;
s16 unk2E;
u8 fill30[0x38 - 0x30];
u16 unk38;
u8 fill3A[0x48 - 0x3A];
/* 0x14 */ struct UnkInputStruct input;
/* 0x48 */ s32 menuAction;
bool8 unk4C;
bool8 unk4D;

View File

@ -8,12 +8,7 @@
struct AdventureLog
{
// size: 0xA0
u8 fill0[0x1A];
/* 0x1A */ s16 unk1A;
/* 0x1C */ s16 unk1C;
/* 0x1E */ s16 currPage;
s16 unk20;
u8 fill22[0x34 - 0x22];
struct UnkInputStruct input;
u32 unk34;
struct UnkTextStruct2 *unk38;
struct UnkTextStruct2 unk3C[4];
@ -47,10 +42,10 @@ const u8 fill_adven[] = "pksdir0";
void sub_8032084();
void DisplayAdventureLog();
extern void sub_8013818(void *, u32, u32, u32);
extern bool8 sub_8013938(void *);
extern void sub_8013660(void *);
extern bool8 sub_8013938(struct UnkInputStruct *);
extern void sub_8013660(struct UnkInputStruct *);
extern void PlayMenuSoundEffect(u32);
extern u32 GetKeyPress(void *);
extern u32 GetKeyPress(struct UnkInputStruct *);
extern bool8 sub_8097710(u8);
extern s16 sub_80978B8();
@ -88,11 +83,11 @@ u32 CreateAdventureLogScreen(u32 param_1)
u32 HandleAdventureLogInput(u8 param_1)
{
if (param_1 == 0) {
sub_8013660(gAdventureLog);
sub_8013660(&gAdventureLog->input);
return 0;
}
else {
switch(GetKeyPress(gAdventureLog))
switch(GetKeyPress(&gAdventureLog->input))
{
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
@ -101,7 +96,7 @@ u32 HandleAdventureLogInput(u8 param_1)
PlayMenuSoundEffect(0);
return 3;
default:
if (sub_8013938(gAdventureLog)) {
if (sub_8013938(&gAdventureLog->input)) {
sub_8032084();
DisplayAdventureLog();
return 1;
@ -131,11 +126,11 @@ void sub_8032084(void)
u32 sVar2;
gAdventureLog->unk9C[0] = gAdventureLog->unk20;
gAdventureLog->unk9C[1]= gAdventureLog->currPage;
gAdventureLog->unk9C[1]= gAdventureLog->unk0.unk1E;
gAdventureLog->unk9C[2]= 0xb;
gAdventureLog->unk9C[3]= 0;
// So a sign extend..
sVar2 = sub_80095E4(gAdventureLog->unk1A,0xc) + 2 << 0x10;
sVar2 = sub_80095E4(gAdventureLog->unk0.unk1A,0xc) + 2 << 0x10;
// TODO needs asr r3, r0, r16
// and lsr r0, r0, r16
gAdventureLog->unk3C[gAdventureLog->unk34].unkE = sVar2;
@ -215,7 +210,7 @@ void DisplayAdventureLog(void)
sub_8008C54(gAdventureLog->unk34);
sub_80073B8(gAdventureLog->unk34);
r4 = gAdventureLog->currPage * 8;
r4 = gAdventureLog->input.unk1E * 8;
r6 = r4;
r6 += 10;
// Draw Header
@ -223,11 +218,11 @@ void DisplayAdventureLog(void)
r4 += 4;
r6 = r4 + gAdventureLog->unk9C[2] * 8;
// Draw Page #
sub_8012BC4(r6, 0, gAdventureLog->currPage + 1, 1, 7, gAdventureLog->unk34);
sub_8012BC4(r6, 0, gAdventureLog->input.unk1E + 1, 1, 7, gAdventureLog->unk34);
for(counter = 0; counter < gAdventureLog->unk1A; counter++)
for(counter = 0; counter < gAdventureLog->input.unk1A; counter++)
{
temp = gAdventureLog->currPage * gAdventureLog->unk1C + counter;
temp = gAdventureLog->input.unk1E * gAdventureLog->input.unk1C + counter;
if(sub_8097710(temp)){
switch(temp) {
case 0xc:

View File

@ -14,11 +14,7 @@ struct Hints
struct unkStruct_203B268
{
// size: 0xA0
u32 unk0;
u8 fill4[0x1E - 0x4];
s16 helpPageIndex;
u16 unk20;
u8 fill22[0x34 - 0x22];
struct UnkInputStruct input;
u32 unk34;
struct UnkTextStruct2 *unk38;
struct UnkTextStruct2 unk3C[4];
@ -28,14 +24,7 @@ struct unkStruct_203B268
struct unkStruct_203B264
{
// size: 0x9C
u32 unk0;
u8 fill4[0x18 - 0x4];
s16 unk18;
s16 unk1A;
s16 unk1C;
s16 unk1E;
u16 unk20;
u8 fill22[0x34 - 0x22];
struct UnkInputStruct input;
u32 unk34;
struct UnkTextStruct2 *unk38;
struct UnkTextStruct2 unk3C[4];
@ -68,9 +57,9 @@ extern void sub_8008C54(u32);
void DrawHintSelectionMenu(void);
void sub_801E594(void);
void sub_8013984(void *);
void AddMenuCursorSprite(void *);
extern u8 sub_80138B8(void *, u32);
extern void sub_8013660(void *);
void AddMenuCursorSprite(struct UnkInputStruct *);
extern u8 sub_80138B8(struct UnkInputStruct *, u32);
extern void sub_8013660(struct UnkInputStruct *);
extern void sub_8012D08(struct UnkTextStruct2 *, u32);
u32 sub_801E3F0(u32 r0)
@ -94,10 +83,10 @@ u32 sub_801E474(u8 r0)
{
if(r0 == 0)
{
sub_8013660(gUnknown_203B264);
sub_8013660(&gUnknown_203B264->input);
return 0;
}
switch(GetKeyPress(gUnknown_203B264))
switch(GetKeyPress(&gUnknown_203B264->input))
{
case 2:
PlayMenuSoundEffect(1);
@ -109,7 +98,7 @@ u32 sub_801E474(u8 r0)
PlayMenuSoundEffect(4);
return 4;
default:
if(sub_80138B8(gUnknown_203B264, 1))
if(sub_80138B8(&gUnknown_203B264->input, 1))
{
sub_801E594();
DrawHintSelectionMenu();
@ -122,7 +111,7 @@ u32 sub_801E474(u8 r0)
s32 GetChosenHintIndex(void)
{
return (gUnknown_203B264->unk1E * gUnknown_203B264->unk1C) + gUnknown_203B264->unk18;
return (gUnknown_203B264->input.unk1E * gUnknown_203B264->input.unk1C) + gUnknown_203B264->input.menuIndex;
}
void CreateHintSelectionScreen(u8 r0)
@ -133,7 +122,7 @@ void CreateHintSelectionScreen(u8 r0)
sub_801E594();
DrawHintSelectionMenu();
if(r0)
AddMenuCursorSprite(gUnknown_203B264);
AddMenuCursorSprite(&gUnknown_203B264->input);
}
void sub_801E54C(void)
@ -219,7 +208,7 @@ u32 CreateHintDisplayScreen(u32 index)
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B268->unk3C, 1, 1);
sub_8013818(gUnknown_203B268, 5, 1, gUnknown_203B268->unk34);
gUnknown_203B268->helpPageIndex = index;
gUnknown_203B268->input.unk1E = index;
sub_801E714();
return 1;
@ -265,8 +254,8 @@ void DestroyHintDisplayScreen(void)
void sub_801E76C(void)
{
gUnknown_203B268->unk9C[0] = gUnknown_203B268->unk20;
gUnknown_203B268->unk9C[1] = gUnknown_203B268->helpPageIndex;
gUnknown_203B268->unk9C[0] = gUnknown_203B268->input.unk20;
gUnknown_203B268->unk9C[1] = gUnknown_203B268->input.unk1E;
gUnknown_203B268->unk9C[2] = 0xF;
gUnknown_203B268->unk9C[3] = 0;
ResetUnusedInputStruct();
@ -276,7 +265,7 @@ void sub_801E76C(void)
void DisplayChosenHint(void)
{
sub_80073B8(gUnknown_203B268->unk34);
xxx_call_draw_string((gUnknown_203B268->helpPageIndex << 3) + 0x10, 0, gGameHints[gUnknown_203B268->helpPageIndex].heading, gUnknown_203B268->unk34, 0);
xxx_call_draw_string(0xA, 0x14, gGameHints[gUnknown_203B268->helpPageIndex].body, gUnknown_203B268->unk34, 0);
xxx_call_draw_string((gUnknown_203B268->input.unk1E << 3) + 0x10, 0, gGameHints[gUnknown_203B268->input.unk1E].heading, gUnknown_203B268->unk34, 0);
xxx_call_draw_string(0xA, 0x14, gGameHints[gUnknown_203B268->input.unk1E].body, gUnknown_203B268->unk34, 0);
sub_80073E0(gUnknown_203B268->unk34);
}

View File

@ -1049,10 +1049,10 @@ u32 sub_801A5D8(u32 param_1,int param_2,struct UnkTextStruct2_sub *param_3,u32 p
sub_8099690(1);
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B224->unk90,1,1);
sub_8013818(&gUnknown_203B224->unk54,GetNumberOfFilledInventorySlots(),param_4,param_2);
gUnknown_203B224->unk6C = gUnknown_203B228;
gUnknown_203B224->unk72 = gUnknown_203B22A;
sub_8013984((u8 *)&gUnknown_203B224->unk54);
sub_8013818(&gUnknown_203B224->input,GetNumberOfFilledInventorySlots(),param_4,param_2);
gUnknown_203B224->input.menuIndex = gUnknown_203B228;
gUnknown_203B224->input.unk1E = gUnknown_203B22A;
sub_8013984((u8 *)&gUnknown_203B224->input);
sub_801A998();
sub_801A9E0();
return 1;
@ -1065,10 +1065,10 @@ u32 sub_801A6E8(u8 param_1)
struct Item item;
if (param_1 == 0) {
sub_8013660(&gUnknown_203B224->unk54);
sub_8013660(&gUnknown_203B224->input);
return 0;
}
switch(GetKeyPress(&gUnknown_203B224->unk54)) {
switch(GetKeyPress(&gUnknown_203B224->input)) {
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
return 2;
@ -1110,7 +1110,7 @@ u32 sub_801A6E8(u8 param_1)
if ((gUnknown_203B224->unk4[index] != 0) || (sub_801ADA0(index) != 0)) {
PlayMenuSoundEffect(6);
gUnknown_203B224->unk4[index] ^= 1;
sub_80138B8(&gUnknown_203B224->unk54,0);
sub_80138B8(&gUnknown_203B224->input,0);
sub_801A9E0();
return 1;
}
@ -1128,7 +1128,7 @@ u32 sub_801A6E8(u8 param_1)
// NOTE: fallthrough needed here
default:
_0801A87C:
if (sub_80138B8(&gUnknown_203B224->unk54,1) != '\0') {
if (sub_80138B8(&gUnknown_203B224->input,1) != '\0') {
sub_801A998();
sub_801A9E0();
return 1;
@ -1142,7 +1142,7 @@ _0801A87C:
s32 sub_801A8AC(void)
{
return (gUnknown_203B224->unk72 * gUnknown_203B224->unk70) + gUnknown_203B224->unk6C;
return (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + gUnknown_203B224->input.menuIndex;
}
void sub_801A8D0(u8 r0)
@ -1151,20 +1151,20 @@ void sub_801A8D0(u8 r0)
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B224->unk90, 0, 0);
FillInventoryGaps();
gUnknown_203B224->unk76 = GetNumberOfFilledInventorySlots();
sub_8013984((u8 *)&gUnknown_203B224->unk54);
gUnknown_203B224->input.unk22 = GetNumberOfFilledInventorySlots();
sub_8013984((u8 *)&gUnknown_203B224->input);
sub_801A998();
sub_801A9E0();
if(r0)
AddMenuCursorSprite((u8 *)&gUnknown_203B224->unk54);
AddMenuCursorSprite((u8 *)&gUnknown_203B224->input);
}
void sub_801A928(void)
{
if(gUnknown_203B224 != NULL)
{
gUnknown_203B228 = gUnknown_203B224->unk6C;
gUnknown_203B22A = gUnknown_203B224->unk72;
gUnknown_203B228 = gUnknown_203B224->input.menuIndex;
gUnknown_203B22A = gUnknown_203B224->input.unk1E;
gUnknown_203B224->unk90[gUnknown_203B224->unk88] = gUnknown_80DB944;
sub_8099690(0);
ResetUnusedInputStruct();
@ -1176,8 +1176,8 @@ void sub_801A928(void)
void sub_801A998(void)
{
gUnknown_203B224->unkF0[0] = gUnknown_203B224->unk74;
gUnknown_203B224->unkF0[1] = gUnknown_203B224->unk72;
gUnknown_203B224->unkF0[0] = gUnknown_203B224->input.unk20;
gUnknown_203B224->unkF0[1] = gUnknown_203B224->input.unk1E;
gUnknown_203B224->unkF0[2] = 0xB;
gUnknown_203B224->unkF0[3] = 0;
ResetUnusedInputStruct();
@ -1201,21 +1201,21 @@ void sub_801A9E0(void)
sub_8008C54(gUnknown_203B224->unk88);
sub_80073B8(gUnknown_203B224->unk88);
x = gUnknown_203B224->unk72 * 8 + 10;
if (gUnknown_203B224->unk72 == 0) {
x = gUnknown_203B224->input.unk1E * 8 + 10;
if (gUnknown_203B224->input.unk1E == 0) {
xxx_call_draw_string(x,0,gTeamToolboxA,gUnknown_203B224->unk88,0);
}
else {
xxx_call_draw_string(x,0,gTeamToolboxB,gUnknown_203B224->unk88,0);
}
for(r7 = 0; r7 < gUnknown_203B224->unk6E; r7++)
for(r7 = 0; r7 < gUnknown_203B224->input.unk1A; r7++)
{
teamItemIndex = (gUnknown_203B224->unk72 * gUnknown_203B224->unk70) + r7;
teamItemIndex = (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + r7;
item = gTeamInventory_203B460->teamItems[teamItemIndex];
switch(gUnknown_203B224->unk0) {
case 0:
sub_8090E14(buffer1,&item,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),buffer1,gUnknown_203B224->unk88,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88,0);
break;
case 1:
case 2:
@ -1224,7 +1224,7 @@ void sub_801A9E0(void)
stack.unk8 = 1;
item.flags = 1;
sub_8090E14(buffer1,&item, &stack);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),buffer1,gUnknown_203B224->unk88,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88,0);
break;
case 3:
stack1.unk0 = 0;
@ -1233,12 +1233,12 @@ void sub_801A9E0(void)
item.flags = 1;
sub_8090E14(buffer1,&item,&stack1);
if (gUnknown_203B224->unk4[teamItemIndex] != 0 || sub_801ADA0(teamItemIndex) != '\0'){
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),buffer1,gUnknown_203B224->unk88,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88,0);
}
else
{
strncpy(gUnknown_202DE58,buffer1,0x50);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->unk54,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->input,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
}
break;
case 4:
@ -1252,15 +1252,15 @@ void sub_801A9E0(void)
if (GetStackSellPrice(&item) + gTeamInventory_203B460->teamMoney > MAX_TEAM_MONEY){
// very dumb but this matches...
sprintfStatic((char *)&stack3,gUnknown_80DB9A0,buffer1);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),(u8 *)&stack3,gUnknown_203B224->unk88,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),(u8 *)&stack3,gUnknown_203B224->unk88,0);
}
else
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),buffer1,gUnknown_203B224->unk88,0);;
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88,0);;
}
else {
sub_8090E14(buffer1,&item, 0);
strncpy(gUnknown_202DE58,buffer1,0x50);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->unk54,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->input,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
}
break;
case 5:
@ -1270,17 +1270,17 @@ void sub_801A9E0(void)
item.flags = 1;
sub_8090E14(buffer1,&item,&stack3);
if (IsGummiItem(item.id)) {
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->unk54,r7),buffer1,gUnknown_203B224->unk88,0);
xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88,0);
}
else
{
strncpy(gUnknown_202DE58,buffer1,0x50);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->unk54,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
xxx_format_and_draw(8,sub_8013800(&gUnknown_203B224->input,r7),gUnknown_80DB994,gUnknown_203B224->unk88,0);
}
break;
}
if ((sub_801AED0(teamItemIndex) & 1) != 0) {
sub_8007B7C(gUnknown_203B224->unk88,8,sub_8013800(&gUnknown_203B224->unk54,r7),(gUnknown_203B224->unk8C->unkC - 2) * 8,10);
sub_8007B7C(gUnknown_203B224->unk88,8,sub_8013800(&gUnknown_203B224->input,r7),(gUnknown_203B224->unk8C->unkC - 2) * 8,10);
}
}
sub_80073E0(gUnknown_203B224->unk88);

View File

@ -881,7 +881,7 @@ bool8 SetMainMenuText(void)
// Have to load the pointer before the index
preload = gUnknown_203B34C->unk4[0].menuItems;
menuChoice = preload[gUnknown_203B34C->unk4[0].menuIndex].menuAction; // chosen menu action?
menuChoice = preload[gUnknown_203B34C->unk4[0].input.menuIndex].menuAction; // chosen menu action?
if (gUnknown_203B34C->currMenuChoice == menuChoice) {
return FALSE;
}

View File

@ -15,15 +15,7 @@ struct unkStruct_203B31C
{
// Size: 0xD0
s16 unk0[NUM_DUNGEON_MAZE];
u32 unk30;
u8 fill34[0x48 - 0x34];
s16 unk48;
s16 unk4A;
s16 unk4C;
s16 unk4E;
u16 unk50;
u16 unk52;
u8 fill54[0x64 - 0x54];
struct UnkInputStruct unk30;
u32 unk64;
struct UnkTextStruct2 *unk68;
struct UnkTextStruct2 unk6C[4];
@ -72,9 +64,9 @@ extern s16 sub_80A2668(u32 r0);
extern s32 sub_8013800(void *, u32);
extern bool8 IsMazeCompleted(s32);
extern s32 sub_8030668(void);
extern void sub_8013984(u32 *);
extern void sub_8013984(void *);
extern void sub_80304C8();
extern void AddMenuCursorSprite(u32 *);
extern void AddMenuCursorSprite(struct UnkInputStruct *);
extern void DrawDojoCourseList(void);
extern u8 sub_80138B8(void *, u32);
@ -234,11 +226,11 @@ u32 sub_80303AC(u8 param_1)
}
s16 sub_8030418(void) {
return gUnknown_203B31C->unk0[(gUnknown_203B31C->unk4E * gUnknown_203B31C->unk4C) + gUnknown_203B31C->unk48];
return gUnknown_203B31C->unk0[(gUnknown_203B31C->unk30.unk1E * gUnknown_203B31C->unk30.unk1C) + gUnknown_203B31C->unk30.menuIndex];
}
void sub_8030444(u8 r0) {
gUnknown_203B31C->unk52 = sub_8030668();
gUnknown_203B31C->unk30.unk22 = sub_8030668();
sub_8013984(&gUnknown_203B31C->unk30);
sub_80304C8();
DrawDojoCourseList();
@ -331,10 +323,10 @@ void DrawDojoCourseList(void)
sub_80073B8(gUnknown_203B31C->unk64);
xxx_call_draw_string(10,0,gMakuhitaDojoHeader,gUnknown_203B31C->unk64,0); // Courses
sub_8012BC4(gUnknown_203B31C->unkCC[2] * 8 + 4,0,
gUnknown_203B31C->unk4E + 1,2,7,gUnknown_203B31C->unk64);
for (index = 0; index < gUnknown_203B31C->unk4A; index++)
gUnknown_203B31C->unk30.unk1E + 1,2,7,gUnknown_203B31C->unk64);
for (index = 0; index < gUnknown_203B31C->unk30.unk1A; index++)
{
iVar6 = gUnknown_203B31C->unk0[gUnknown_203B31C->unk4E * gUnknown_203B31C->unk4C + index];
iVar6 = gUnknown_203B31C->unk0[gUnknown_203B31C->unk30.unk1E * gUnknown_203B31C->unk30.unk1C + index];
dungeonIndex = sub_80A2740(iVar6);
mazeIndex = sub_80A2668(iVar6);

View File

@ -17,24 +17,27 @@ extern struct UnkTextStruct1 gUnknown_2027370[4];
extern u8 gUnknown_80D4828[];
extern void PlayMenuSoundEffect(u32);
extern s32 GetKeyPress(u32 *);
extern u32 sub_80137A8(u32 *);
void MoveMenuCursorUp(u32 *);
void MoveMenuCursorDown(u32 *);
extern s32 GetKeyPress(struct UnkInputStruct *);
extern u32 sub_80137A8(struct UnkInputStruct *);
void MoveMenuCursorUp(struct UnkInputStruct *);
void MoveMenuCursorDown(struct UnkInputStruct *);
extern void sub_80073B8(u32);
extern s32 sub_8008ED0(const u8 *);
extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32);
extern s32 sub_8013800(u32 *, s32);
extern s32 sub_8013800(struct UnkInputStruct *, s32);
extern void sub_80073E0(u32);
extern void sub_8013660(u32 *);
void AddMenuCursorSprite(void *);
extern void sub_8013660(struct UnkInputStruct *);
void AddMenuCursorSprite(struct UnkInputStruct *);
void AddMenuCursorSprite_(struct UnkInputStruct *, u32);
void sub_8012EBC(struct MenuStruct *param_1);
extern void sub_8013134(u32 *, u32, u32);
extern void sub_80137B0(u32 *, u32);
extern void sub_8013134(struct UnkInputStruct *, u32, u32);
extern void sub_80137B0(struct UnkInputStruct *, u32);
extern s16 sub_8009614(u32, u32);
extern u32 ReturnIntFromChar2(u8);
struct unkChar *GetCharacter(u32);
extern void xxx_call_draw_char(u32, u32, u32, u32, u32);
extern void sub_801317C(struct UnkInputStructSub *);
extern void nullsub_7(u16 *);
const u32 gDefaultMenuTextColors[] = { COLOR_WHITE_2, COLOR_RED, COLOR_RED };
@ -228,9 +231,9 @@ void sub_8012D60(struct MenuStruct *param_1,const struct MenuItem *menuItems,u32
if (menuIndex < 0) {
menuIndex = iVar1;
}
sub_8013134(&param_1->unk14,counter,index);
param_1->menuIndex = menuIndex;
sub_80137B0(&param_1->unk14,0);
sub_8013134(&param_1->input,counter,index);
param_1->input.menuIndex = menuIndex;
sub_80137B0(&param_1->input,0);
param_1->unk4C = TRUE;
param_1->unk4D = TRUE;
param_1->unk4E = TRUE;
@ -268,9 +271,9 @@ void sub_8012E04(struct MenuStruct *param_1,const struct MenuItem *menuItems,u32
if (menuIndex < 0) {
menuIndex = iVar1;
}
sub_8013134(&param_1->unk14,counter,index);
param_1->menuIndex = menuIndex;
sub_80137B0(&param_1->unk14,0);
sub_8013134(&param_1->input,counter,index);
param_1->input.menuIndex = menuIndex;
sub_80137B0(&param_1->input,0);
param_1->index = index;
param_1->menuTextColorArray = colorArray;
if (colorArray == NULL) {
@ -341,7 +344,7 @@ void sub_8012EBC(struct MenuStruct *param_1)
color = colorArray[0];
}
sprintfStatic(buffer,gUnknown_80D4828,color,textPtr);
y = sub_8013800(&param_1->unk14,counter);
y = sub_8013800(&param_1->input,counter);
xxx_format_and_draw(8,y,buffer,param_1->index,0);
menuItemsPtr++;
counter++;
@ -352,10 +355,10 @@ void sub_8012EBC(struct MenuStruct *param_1)
}
if (param_1->unk4E) {
if (param_1->unk4C) {
AddMenuCursorSprite(&param_1->unk14);
AddMenuCursorSprite(&param_1->input);
}
else {
sub_8013660(&param_1->unk14);
sub_8013660(&param_1->input);
}
}
}
@ -366,31 +369,31 @@ bool8 sub_8012FD8(struct MenuStruct *param_1)
s32 index;
const struct MenuItem *item;
prevMenuIndex = param_1->menuIndex;
prevMenuIndex = param_1->input.menuIndex;
if (param_1->unk4C) {
switch(GetKeyPress(&param_1->unk14))
switch(GetKeyPress(&param_1->input))
{
case INPUT_DPAD_DOWN:
MoveMenuCursorDown(&param_1->unk14);
if (prevMenuIndex != param_1->menuIndex) {
MoveMenuCursorDown(&param_1->input);
if (prevMenuIndex != param_1->input.menuIndex) {
PlayMenuSoundEffect(3);
}
break;
case INPUT_DPAD_UP:
MoveMenuCursorUp(&param_1->unk14);
if (prevMenuIndex != param_1->menuIndex) {
MoveMenuCursorUp(&param_1->input);
if (prevMenuIndex != param_1->input.menuIndex) {
PlayMenuSoundEffect(3);
}
break;
case INPUT_A_BUTTON:
index = sub_80137A8(&param_1->unk14);
index = sub_80137A8(&param_1->input);
item = &param_1->menuItems[index];
if ((-1 < item->menuAction) &&
((param_1->unkC == NULL || (param_1->unkC[index] != 1)))) {
param_1->menuAction = item->menuAction;
++param_1; --param_1;
param_1->unk4C = FALSE;
param_1->unk38 = 0;
param_1->input.unk24 = 0;
}
else
{
@ -404,8 +407,8 @@ bool8 sub_8012FD8(struct MenuStruct *param_1)
PlayMenuSoundEffect(0);
break;
case INPUT_B_BUTTON:
if (-1 < param_1->menuItems[param_1->unk2E].menuAction) {
param_1->menuAction = param_1->menuItems[param_1->unk2E].menuAction;
if (-1 < param_1->menuItems[param_1->input.unk1A].menuAction) {
param_1->menuAction = param_1->menuItems[param_1->input.unk1A].menuAction;
param_1->unk4C = FALSE;
PlayMenuSoundEffect(1);
}
@ -424,18 +427,18 @@ bool8 sub_80130A8(struct MenuStruct *param_1)
if (param_1->unk4C) {
switch(GetKeyPress(&param_1->unk14))
switch(GetKeyPress(&param_1->input))
{
case INPUT_A_BUTTON:
index = sub_80137A8(&param_1->unk14);
index = sub_80137A8(&param_1->input);
menuItem = &param_1->menuItems[index];
param_1->menuAction = menuItem->menuAction;
param_1->unk4C = FALSE;
param_1->unk38 = 0;
param_1->input.unk24 = 0;
PlayMenuSoundEffect(0);
break;
case INPUT_B_BUTTON:
if(menuAction = param_1->menuItems[param_1->unk2E].menuAction, -1 < menuAction) {
if(menuAction = param_1->menuItems[param_1->input.unk1A].menuAction, -1 < menuAction) {
param_1->menuAction = menuAction;
param_1->unk4C = FALSE;
PlayMenuSoundEffect(0);
@ -457,3 +460,51 @@ bool8 sub_8013114(struct MenuStruct *param_1, s32 *menuAction)
}
return FALSE;
}
void sub_8013134(struct UnkInputStruct *param_1, u32 menuItemCounter, u32 index) {
struct UnkTextStruct1 *temp;
temp = &gUnknown_2027370[index];
param_1->unk0 = index;
param_1->menuIndex = 0;
param_1->unk1A = menuItemCounter;
param_1->unk1C = menuItemCounter;
param_1->unk1E = 0;
param_1->unk4 = 0;
if(temp->unkC == 6)
{
param_1->unk6 = 0x10;
}
else
{
param_1->unk6 = 0x2;
}
param_1->unkC = 0;
param_1->unkE = 0;
param_1->unk14 = 0;
param_1->unk24 = 0;
sub_801317C(&param_1->unk28);
}
void sub_801317C(struct UnkInputStructSub *param_1)
{
param_1->unk0 = 0;
param_1->a_button = 0;
param_1->b_button = 0;
param_1->dpad_left = 0;
param_1->dpad_right = 0;
param_1->unk8 = -1;
param_1->unkA = -1;
nullsub_7(&param_1->unk8);
ResetUnusedInputStruct();
}
void AddMenuCursorSprite(struct UnkInputStruct *param_1)
{
AddMenuCursorSprite_(param_1, 0);
}

View File

@ -1,12 +1,12 @@
#include "constants/input.h"
#include "global.h"
#include "constants/input.h"
#include "input.h"
extern void nullsub_34(struct UnkInputStruct *r0);
extern void nullsub_34(struct UnkInputStructSub *r0);
u32 sub_8012AE8(void);
u32 sub_8012A64(struct UnkInputStruct *r0, u32 r1)
u32 sub_8012A64(struct UnkInputStructSub *r0, u32 r1)
{
if(r0 == NULL)
{
@ -16,36 +16,39 @@ u32 sub_8012A64(struct UnkInputStruct *r0, u32 r1)
{
nullsub_34(r0);
}
if(r0->unk1 != 0)
if(r0->a_button != 0)
{
r0->unk1 = 0;
return 1;
r0->a_button = 0;
return INPUT_A_BUTTON;
}
if(r0->unk2 == 0)
else if(r0->b_button == 0)
{
return sub_8012AE8();
}
r0->unk2 = r0->unk1;
return 2;
else
{
r0->b_button = 0;
return INPUT_B_BUTTON;
}
}
u32 GetKeyPress(struct UnkInputStruct *r0)
{
if(r0 != NULL)
{
if(r0->a_button != 0)
if(r0->unk28.a_button != 0)
{
return INPUT_A_BUTTON;
}
if(r0->b_button != 0)
if(r0->unk28.b_button != 0)
{
return INPUT_B_BUTTON;
}
if(r0->dpad_left != 0)
if(r0->unk28.dpad_left != 0)
{
return INPUT_DPAD_LEFT;
}
if(r0->dpad_right != 0)
if(r0->unk28.dpad_right != 0)
{
return INPUT_DPAD_RIGHT;
}

View File

@ -14,22 +14,8 @@ struct unkStruct_203B2CC
{
// size: 0xD4;
u8 receivedNewsletters[NUM_POKEMON_NEWS];
u32 unk38;
u8 fill3C[0x50 - 0x3C];
s16 unk50;
s16 unk52;
s16 unk54;
s16 unk56;
u16 unk58;
u16 numPKMNNews;
u8 fill5C[0x6C - 0x5C];
struct UnkInputStruct input;
u32 unk6C;
struct UnkTextStruct2 *unk70;
struct UnkTextStruct2 unk74[4];
};
@ -55,15 +41,7 @@ struct unkStruct_203B2D8
{
// size: 0xA4
u8 unk0[4];
u32 unk4;
u8 fill8[0x1C - 0x8];
s16 unk1C;
s16 unk1E;
s16 unk20;
s16 unk22;
s16 fill24;
/* 0x26 */ s16 emptyMailSlots;
u8 fill28[0x38 - 0x28];
struct UnkInputStruct input;
u32 unk38;
struct UnkTextStruct2 *unk3C;
struct UnkTextStruct2 unk40[4];
@ -180,9 +158,9 @@ extern void CreatePKMNNewsMenu(void);
extern void sub_8013818(void *, u32, u32, u32);
extern u8 sub_80138B8(void *, u32);
extern void PlayMenuSoundEffect(u32);
extern s32 GetKeyPress(u32 *);
extern void sub_8013660(u32 *);
extern void AddMenuCursorSprite(u32 *);
extern s32 GetKeyPress(struct UnkInputStruct *);
extern void sub_8013660(struct UnkInputStruct *);
extern void AddMenuCursorSprite(struct UnkInputStruct *);
extern void sub_802BCC4(void);
extern void sub_802BB14(u32);
extern void sub_801317C(u32 *);
@ -190,7 +168,7 @@ extern u8 HasNoMailinMailbox(void);
extern void sub_802BF30(void);
extern void CreateMailMenu(void);
extern s32 CountEmptyMailSlots(void);
extern void sub_8013848(u32 *, s32, u32, u32);
extern void sub_8013848(struct UnkInputStruct*, s32, u32, u32);
void sub_802BB28(void);
extern void sub_802BB98(void);
extern void sub_802BC08(void);
@ -206,8 +184,8 @@ extern void sub_80073E0(u32);
extern void xxx_call_draw_string(s32 x, u32 y, const u8 *, u32 , u32);
extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32);
extern void sub_803B6B0(u32, u32, u32, u32);
extern s32 sub_8013800(u32 *, s32);
extern void sub_8013984(u32 *);
extern s32 sub_8013800(struct UnkInputStruct *, s32);
extern void sub_8013984(struct UnkInputStruct *);
extern struct PokemonStruct *sub_808D3BC(void);
extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon);
@ -240,12 +218,12 @@ u32 sub_802B640(u32 r0, struct UnkTextStruct2_sub *r1, u32 r2)
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2CC->unk74, 1, 1);
sub_8013818(&gUnknown_203B2CC->unk38, GetNumPKMNNews(), r2, r0);
sub_8013818(&gUnknown_203B2CC->input, GetNumPKMNNews(), r2, r0);
gUnknown_203B2CC->unk50 = gUnknown_203B2D0;
gUnknown_203B2CC->unk56 = gUnknown_203B2D2;
gUnknown_203B2CC->input.menuIndex = gUnknown_203B2D0;
gUnknown_203B2CC->input.unk1E = gUnknown_203B2D2;
sub_8013984(&gUnknown_203B2CC->unk38);
sub_8013984(&gUnknown_203B2CC->input);
sub_802B880();
CreatePKMNNewsMenu();
@ -257,12 +235,12 @@ u32 sub_802B720(u8 r0)
{
if(r0 == 0)
{
sub_8013660(&gUnknown_203B2CC->unk38);
sub_8013660(&gUnknown_203B2CC->input);
return 0;
}
else
{
switch(GetKeyPress(&gUnknown_203B2CC->unk38))
switch(GetKeyPress(&gUnknown_203B2CC->input))
{
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
@ -274,7 +252,7 @@ u32 sub_802B720(u8 r0)
PlayMenuSoundEffect(4);
return 4;
}
if(sub_80138B8(&gUnknown_203B2CC->unk38, 1) != 0)
if(sub_80138B8(&gUnknown_203B2CC->input, 1) != 0)
{
sub_802B880();
CreatePKMNNewsMenu();
@ -287,7 +265,7 @@ u32 sub_802B720(u8 r0)
u8 GetPokemonNewsIndex(void)
{
return gUnknown_203B2CC->receivedNewsletters[(gUnknown_203B2CC->unk56 * gUnknown_203B2CC->unk54) + gUnknown_203B2CC->unk50];
return gUnknown_203B2CC->receivedNewsletters[(gUnknown_203B2CC->input.unk1E * gUnknown_203B2CC->input.unk1C) + gUnknown_203B2CC->input.menuIndex];
}
void sub_802B7D0(u8 r0)
@ -295,14 +273,14 @@ void sub_802B7D0(u8 r0)
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2CC->unk74, 0, 0);
gUnknown_203B2CC->numPKMNNews = GetNumPKMNNews();
sub_8013984(&gUnknown_203B2CC->unk38);
gUnknown_203B2CC->input.unk22 = GetNumPKMNNews();
sub_8013984(&gUnknown_203B2CC->input);
sub_802B880();
CreatePKMNNewsMenu();
if(r0 != 0)
{
AddMenuCursorSprite(&gUnknown_203B2CC->unk38);
AddMenuCursorSprite(&gUnknown_203B2CC->input);
}
}
@ -310,9 +288,9 @@ void sub_802B81C(void)
{
if(gUnknown_203B2CC != NULL)
{
gUnknown_203B2D0 = gUnknown_203B2CC->unk50;
gUnknown_203B2D0 = gUnknown_203B2CC->input.menuIndex;
gUnknown_203B2D2 = gUnknown_203B2CC->unk56;
gUnknown_203B2D2 = gUnknown_203B2CC->input.unk1E;
gUnknown_203B2CC->unk74[gUnknown_203B2CC->unk6C] = gUnknown_80DFBD0;
@ -380,11 +358,11 @@ void CreatePKMNNewsMenu(void)
sub_8008C54(gUnknown_203B2CC->unk6C);
sub_80073B8(gUnknown_203B2CC->unk6C);
xxx_call_draw_string(0xA, 0, gUnknown_80DFC04, gUnknown_203B2CC->unk6C, 0);
sub_8012BC4(((gUnknown_80DFBE8[2] << 3) + 4), 0, gUnknown_203B2CC->unk56 + 1, 2, 7, gUnknown_203B2CC->unk6C);
for(index = 0; index < gUnknown_203B2CC->unk52; index++)
sub_8012BC4(((gUnknown_80DFBE8[2] << 3) + 4), 0, gUnknown_203B2CC->input.unk1E + 1, 2, 7, gUnknown_203B2CC->unk6C);
for(index = 0; index < gUnknown_203B2CC->input.unk1A; index++)
{
y = sub_8013800(&gUnknown_203B2CC->unk38, index);
new_index = (gUnknown_203B2CC->unk56 * gUnknown_203B2CC->unk54) + index;
y = sub_8013800(&gUnknown_203B2CC->input, index);
new_index = (gUnknown_203B2CC->input.unk1E * gUnknown_203B2CC->input.unk1C) + index;
mailIndex = gUnknown_203B2CC->receivedNewsletters[new_index];
sub_803B6B0(0xA, y, 6, gUnknown_203B2CC->unk6C);
sub_802BC7C();
@ -607,9 +585,9 @@ u32 sub_802BD14(s32 param_1, struct UnkTextStruct2_sub *param_2, u32 param_3)
sub_8012D34(gUnknown_203B2D8->unk3C,param_3);
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2D8->unk40,1,1);
sub_8013848(&gUnknown_203B2D8->unk4,CountEmptyMailSlots(),param_3,param_1);
gUnknown_203B2D8->unk1C = gUnknown_203B2DC;
sub_8013984(&gUnknown_203B2D8->unk4);
sub_8013848(&gUnknown_203B2D8->input,CountEmptyMailSlots(),param_3,param_1);
gUnknown_203B2D8->input.menuIndex = gUnknown_203B2DC;
sub_8013984(&gUnknown_203B2D8->input);
sub_802BF30();
CreateMailMenu();
return 1;
@ -620,10 +598,10 @@ u32 sub_802BDEC(u8 r0)
{
if(r0 == 0)
{
sub_8013660(&gUnknown_203B2D8->unk4);
sub_8013660(&gUnknown_203B2D8->input);
return 0;
}
switch(GetKeyPress(&gUnknown_203B2D8->unk4))
switch(GetKeyPress(&gUnknown_203B2D8->input))
{
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
@ -635,7 +613,7 @@ u32 sub_802BDEC(u8 r0)
PlayMenuSoundEffect(4);
return 4;
default:
if(sub_80138B8(&gUnknown_203B2D8->unk4, 1) != 0)
if(sub_80138B8(&gUnknown_203B2D8->input, 1) != 0)
{
sub_802BF30();
CreateMailMenu();
@ -647,7 +625,7 @@ u32 sub_802BDEC(u8 r0)
}
u8 sub_802BE74(void) {
return gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + gUnknown_203B2D8->unk1C];
return gUnknown_203B2D8->unk0[(gUnknown_203B2D8->input.unk1E * gUnknown_203B2D8->input.unk1C) + gUnknown_203B2D8->input.menuIndex];
}
void sub_802BE94(u8 r0)
@ -655,14 +633,14 @@ void sub_802BE94(u8 r0)
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2D8->unk40, 0, 0);
gUnknown_203B2D8->emptyMailSlots = CountEmptyMailSlots();
sub_8013984(&gUnknown_203B2D8->unk4);
gUnknown_203B2D8->input.unk22 = CountEmptyMailSlots();
sub_8013984(&gUnknown_203B2D8->input);
sub_802BF30();
CreateMailMenu();
if(r0 != 0)
{
AddMenuCursorSprite(&gUnknown_203B2D8->unk4);
AddMenuCursorSprite(&gUnknown_203B2D8->input);
}
}
@ -670,7 +648,7 @@ void sub_802BEDC(void)
{
if(gUnknown_203B2D8 != NULL)
{
gUnknown_203B2DC = gUnknown_203B2D8->unk1C;
gUnknown_203B2DC = gUnknown_203B2D8->input.menuIndex;
gUnknown_203B2D8->unk40[gUnknown_203B2D8->unk38] = gUnknown_80DFC5C;
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2D8->unk40, 1, 1);

View File

@ -29,8 +29,7 @@ EWRAM_DATA_2 struct PostOfficeHelper *gPostOfficeHelper = {0};
struct unkStruct_203B330
{
// size: 0x78
struct UnkInputStruct *unk0;
u8 fill4[0x8];
struct UnkInputStructSub input;
u8 unkC;
u8 dungeonIndex;
u8 fillE[2];
@ -179,7 +178,7 @@ extern u8 gAvailablePokemonNames[];
extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32);
extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, struct OpenedFile **r5, u32);
extern u32 sub_8012A64(struct UnkInputStruct**, u32);
extern u32 sub_8012A64(struct UnkInputStructSub *, u32);
extern void PlayMenuSoundEffect(u32);
extern void sub_8031A84();
extern void DisplayMissionObjectives();
@ -536,7 +535,7 @@ u32 sub_80319A4(u8 param_1,u8 dungeon,int param_3)
gUnknown_203B330 = MemoryAlloc(sizeof(struct unkStruct_203B330),8);
gUnknown_203B330->unkC = param_1;
gUnknown_203B330->dungeonIndex = dungeon;
sub_801317C(&gUnknown_203B330->unk0);
sub_801317C(&gUnknown_203B330->input);
gUnknown_203B330->unk10 = param_3;
gUnknown_203B330->unk14 = &gUnknown_203B330->unk18[param_3];
sub_8031A2C();
@ -545,7 +544,7 @@ u32 sub_80319A4(u8 param_1,u8 dungeon,int param_3)
u32 sub_80319F8(void)
{
switch(sub_8012A64(&gUnknown_203B330->unk0, gUnknown_203B330->unk10))
switch(sub_8012A64(&gUnknown_203B330->input, gUnknown_203B330->unk10))
{
case 2:
PlayMenuSoundEffect(1);

View File

@ -12,21 +12,21 @@
bool8 IsMailSlotEmpty(u8);
extern void sub_8013984(void *);
extern void sub_8013848(u32 *, s32, u32, u32);
extern void sub_8013848(struct UnkInputStruct *, s32, u32, u32);
extern s32 CountPelipperBoardSlots(void);
extern void sub_802C328(void);
extern void DrawPelipperBoardJobMenu(void);
extern void PlayMenuSoundEffect(u32);
extern void sub_8013660(u32 *);
extern s32 GetKeyPress(u32 *);
extern bool8 sub_80138B8(u32 *, u32);
extern void AddMenuCursorSprite(u32 *);
extern void sub_8013660(struct UnkInputStruct *);
extern s32 GetKeyPress(struct UnkInputStruct *);
extern bool8 sub_80138B8(struct UnkInputStruct *, u32);
extern void AddMenuCursorSprite(struct UnkInputStruct *);
extern u8 HasNoPelipperBoardJobs(void);
extern void sub_8008C54(u32);
extern void sub_80073B8(u32);
extern void sub_80073E0(u32);
extern s32 sub_8013800(u32 *, s32);
extern s32 sub_8013800(struct UnkInputStruct *, s32);
extern struct WonderMail *GetPelipperBoardSlotInfo(u32);
extern void sub_803B35C(struct WonderMail *, u32 *);
extern u8 gBulletinBoardText[];
@ -39,37 +39,20 @@ struct unkStruct_203B2D8
{
// size: 0xA4
u8 unk0[4];
u32 unk4;
u8 fill8[0x1C - 0x8];
s16 unk1C;
s16 unk1E;
s16 unk20;
s16 unk22;
s16 fill24;
/* 0x26 */ s16 emptyMailSlots;
u8 fill28[0x38 - 0x28];
struct UnkInputStruct input;
u32 unk38;
struct UnkTextStruct2 *unk3C;
struct UnkTextStruct2 unk40[4];
u8 unkA0[4];
};
extern struct unkStruct_203B2D8 *gUnknown_203B2D8;
struct unkStruct_203B2E0
{
// size: 0xA8
u8 unk0[0x8];
u32 unk8;
u8 unkC[0x20 - 0xC];
s16 unk20;
s16 unk22;
s16 unk24;
s16 unk26;
s16 unk28;
s16 pelipperBoardSlots;
u8 fill22[0x3C - 0x2C];
struct UnkInputStruct input;
s32 unk3C;
struct UnkTextStruct2 *unk40;
struct UnkTextStruct2 unk44[4];
@ -99,13 +82,13 @@ void CreateMailMenu(void)
sub_8008C54(gUnknown_203B2D8->unk38);
sub_80073B8(gUnknown_203B2D8->unk38);
xxx_call_draw_string(gUnknown_203B2D8->unk22 * 8 + 10,0,gMailboxText,gUnknown_203B2D8->unk38,0);
for (index = 0; index < gUnknown_203B2D8->unk1E; index++) {
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + index]);
xxx_call_draw_string(gUnknown_203B2D8->input.unk1E * 8 + 10,0,gMailboxText,gUnknown_203B2D8->unk38,0);
for (index = 0; index < gUnknown_203B2D8->input.unk1A; index++) {
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->input.unk1E * gUnknown_203B2D8->input.unk1C) + index]);
local.unk0[0] = gUnknown_203B2D8->unk38;
local.y = sub_8013800(&gUnknown_203B2D8->unk4, index);
local.y = sub_8013800(&gUnknown_203B2D8->input, index);
if (mail->mailType == MAIL_TYPE_UNK1) {
y = sub_8013800(&gUnknown_203B2D8->unk4, index);
y = sub_8013800(&gUnknown_203B2D8->input, index);
sub_803B6B0(10,y,6,gUnknown_203B2D8->unk38);
PrintPokeNameToBuffer(gAvailablePokemonNames, GetPlayerPokemonStruct());
sprintfStatic(buffer, GetPokemonMailHeadline(mail->dungeon.floor), gAvailablePokemonNames);
@ -173,9 +156,9 @@ bool8 sub_802C10C(s32 param_1,struct UnkTextStruct2_sub *param_2,s32 param_3)
sub_8012D34(gUnknown_203B2E0->unk40,param_3);
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44,1,1);
sub_8013848(&gUnknown_203B2E0->unk8,CountPelipperBoardSlots(),param_3,param_1);
gUnknown_203B2E0->unk20 = gUnknown_203B2E4;
sub_8013984(&gUnknown_203B2E0->unk8);
sub_8013848(&gUnknown_203B2E0->input,CountPelipperBoardSlots(),param_3,param_1);
gUnknown_203B2E0->input.menuIndex = gUnknown_203B2E4;
sub_8013984(&gUnknown_203B2E0->input);
sub_802C328();
DrawPelipperBoardJobMenu();
return TRUE;
@ -185,11 +168,11 @@ bool8 sub_802C10C(s32 param_1,struct UnkTextStruct2_sub *param_2,s32 param_3)
u32 sub_802C1E4(u8 param_1)
{
if (param_1 == '\0') {
sub_8013660(&gUnknown_203B2E0->unk8);
sub_8013660(&gUnknown_203B2E0->input);
return 0;
}
else {
switch(GetKeyPress(&gUnknown_203B2E0->unk8))
switch(GetKeyPress(&gUnknown_203B2E0->input))
{
case INPUT_B_BUTTON:
PlayMenuSoundEffect(1);
@ -201,7 +184,7 @@ u32 sub_802C1E4(u8 param_1)
PlayMenuSoundEffect(4);
return 4;
default:
if (sub_80138B8(&gUnknown_203B2E0->unk8,1)) {
if (sub_80138B8(&gUnknown_203B2E0->input,1)) {
sub_802C328();
DrawPelipperBoardJobMenu();
return 1;
@ -215,26 +198,26 @@ u32 sub_802C1E4(u8 param_1)
u8 sub_802C26C(void)
{
return gUnknown_203B2E0->unk0[(gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24) + gUnknown_203B2E0->unk20];
return gUnknown_203B2E0->unk0[(gUnknown_203B2E0->input.unk1E * gUnknown_203B2E0->input.unk1C) + gUnknown_203B2E0->input.menuIndex];
}
void sub_802C28C(u8 r0)
{
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44, 0, 0);
gUnknown_203B2E0->pelipperBoardSlots = CountPelipperBoardSlots();
sub_8013984(&gUnknown_203B2E0->unk8);
gUnknown_203B2E0->input.unk22 = CountPelipperBoardSlots();
sub_8013984(&gUnknown_203B2E0->input);
sub_802C328();
DrawPelipperBoardJobMenu();
if(r0)
AddMenuCursorSprite(&gUnknown_203B2E0->unk8);
AddMenuCursorSprite(&gUnknown_203B2E0->input);
}
void sub_802C2D4(void)
{
if(gUnknown_203B2E0 != NULL)
{
gUnknown_203B2E4 = gUnknown_203B2E0->unk20;
gUnknown_203B2E4 = gUnknown_203B2E0->input.menuIndex;
gUnknown_203B2E0->unk44[gUnknown_203B2E0->unk3C] = gUnknown_80DFC9C;
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B2E0->unk44, 1, 1);
@ -314,20 +297,20 @@ void DrawPelipperBoardJobMenu(void)
sub_8008C54(gUnknown_203B2E0->unk3C);
sub_80073B8(gUnknown_203B2E0->unk3C);
iVar4 = gUnknown_203B2E0->unk26 * 8;
iVar4 = gUnknown_203B2E0->input.unk1E * 8;
x = iVar4;
x += 10;
xxx_call_draw_string(x,0,gBulletinBoardText,gUnknown_203B2E0->unk3C,0);
iVar4 += 4;
x = iVar4 + gUnknown_203B2E0->unkA4[2] * 8;
sub_8012BC4(x,0,gUnknown_203B2E0->unk26 + 1,2,7,gUnknown_203B2E0->unk3C);
sub_8012BC4(x,0,gUnknown_203B2E0->input.unk1E + 1,2,7,gUnknown_203B2E0->unk3C);
for(index = 0; index < gUnknown_203B2E0->unk22; index++)
for(index = 0; index < gUnknown_203B2E0->input.unk1A; index++)
{
slotIndex = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24 + index]);
slotIndex = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->input.unk1E * gUnknown_203B2E0->input.unk1C + index]);
mail = GetPelipperBoardSlotInfo(slotIndex);
local.unk0[0] = gUnknown_203B2E0->unk3C;
local.y = sub_8013800(&gUnknown_203B2E0->unk8,index);
local.y = sub_8013800(&gUnknown_203B2E0->input,index);
sub_803B35C(mail,local.unk0);
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(slotIndex))) {
local.unk43 = 2;