mirror of
https://github.com/pret/pmd-red.git
synced 2026-03-21 17:46:39 -05:00
Eliminate a goto chain
This commit is contained in:
parent
31a8737dd4
commit
c94d3dbf71
|
|
@ -74,84 +74,90 @@ bool8 sub_801A5D8(u32 param_1, s32 param_2, DungeonPos *param_3, u32 param_4)
|
|||
// arm9.bin::02026954
|
||||
u32 sub_801A6E8(bool8 param_1)
|
||||
{
|
||||
s32 index;
|
||||
Item item;
|
||||
|
||||
if (param_1 == FALSE) {
|
||||
sub_8013660(&gUnknown_203B224->unk54.m.input);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (GetKeyPress(&gUnknown_203B224->unk54.m.input)) {
|
||||
case INPUT_B_BUTTON:
|
||||
case INPUT_B_BUTTON: {
|
||||
PlayMenuSoundEffect(MENU_SFX_BACK);
|
||||
return 2;
|
||||
case INPUT_A_BUTTON:
|
||||
}
|
||||
case INPUT_A_BUTTON: {
|
||||
switch (gUnknown_203B224->unk0) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 2: {
|
||||
if (gUnknown_203B224->unk4[sub_801A8AC()] != 0)
|
||||
PlayMenuSoundEffect(MENU_SFX_FAIL);
|
||||
else
|
||||
PlayMenuSoundEffect(MENU_SFX_ACCEPT);
|
||||
break;
|
||||
case 3:
|
||||
}
|
||||
case 3: {
|
||||
if (sub_801AEA8() != 0 || sub_801ADA0(sub_801A8AC()))
|
||||
PlayMenuSoundEffect(MENU_SFX_ACCEPT);
|
||||
else
|
||||
PlayMenuSoundEffect(MENU_SFX_FAIL);
|
||||
break;
|
||||
case 4:
|
||||
item = gTeamInventoryRef->teamItems[sub_801A8AC()];
|
||||
}
|
||||
case 4: {
|
||||
Item item = gTeamInventoryRef->teamItems[sub_801A8AC()];
|
||||
|
||||
if (IsShoppableItem(item.id) && GetActualSellPrice(&item) + gTeamInventoryRef->teamMoney <= MAX_TEAM_MONEY)
|
||||
PlayMenuSoundEffect(MENU_SFX_ACCEPT);
|
||||
else
|
||||
PlayMenuSoundEffect(MENU_SFX_FAIL);
|
||||
break;
|
||||
case 5:
|
||||
}
|
||||
case 5: {
|
||||
PlayMenuSoundEffect(MENU_SFX_ACCEPT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
case INPUT_START_BUTTON:
|
||||
}
|
||||
case INPUT_START_BUTTON: {
|
||||
PlayMenuSoundEffect(MENU_SFX_INFO);
|
||||
return 4;
|
||||
}
|
||||
case INPUT_L_BUTTON:
|
||||
case INPUT_R_BUTTON:
|
||||
if (gUnknown_203B224->unk0 != 3)
|
||||
goto _0801A87C;
|
||||
case INPUT_R_BUTTON: {
|
||||
if (gUnknown_203B224->unk0 == 3) {
|
||||
s32 index = sub_801A8AC();
|
||||
|
||||
index = sub_801A8AC();
|
||||
if (gUnknown_203B224->unk4[index] != 0 || sub_801ADA0(index)) {
|
||||
PlayMenuSoundEffect(MENU_SFX_TOGGLE);
|
||||
gUnknown_203B224->unk4[index] ^= 1;
|
||||
MenuCursorUpdate(&gUnknown_203B224->unk54.m.input, 0);
|
||||
sub_801A9E0();
|
||||
return 1;
|
||||
if (gUnknown_203B224->unk4[index] != 0 || sub_801ADA0(index)) {
|
||||
PlayMenuSoundEffect(MENU_SFX_TOGGLE);
|
||||
gUnknown_203B224->unk4[index] ^= 1;
|
||||
MenuCursorUpdate(&gUnknown_203B224->unk54.m.input, 0);
|
||||
sub_801A9E0();
|
||||
return 1;
|
||||
}
|
||||
|
||||
PlayMenuSoundEffect(MENU_SFX_FAIL);
|
||||
}
|
||||
|
||||
PlayMenuSoundEffect(MENU_SFX_FAIL);
|
||||
goto _0801A87C;
|
||||
case INPUT_SELECT_BUTTON:
|
||||
break;
|
||||
}
|
||||
case INPUT_SELECT_BUTTON: {
|
||||
if (gUnknown_203B224->unk0 != 2) {
|
||||
PlayMenuSoundEffect(MENU_SFX_SORT);
|
||||
SortInventoryItems();
|
||||
sub_801A9E0();
|
||||
}
|
||||
// NOTE: fallthrough needed here
|
||||
default:
|
||||
_0801A87C:
|
||||
if (MenuCursorUpdate(&gUnknown_203B224->unk54.m.input, 1) != FALSE) {
|
||||
sub_801A998();
|
||||
sub_801A9E0();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MenuCursorUpdate(&gUnknown_203B224->unk54.m.input, 1)) {
|
||||
sub_801A998();
|
||||
sub_801A9E0();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// arm9.bin::02026934
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user