From 4faefa1b1b81a6c18eb7a4f1a773a63ccd77deea Mon Sep 17 00:00:00 2001 From: Rose <83477269+AreaZR@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:44:26 -0400 Subject: [PATCH] Decompile sub_810EAC8 and sub_810F1F4 --- src/field_specials.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/field_specials.c b/src/field_specials.c index b607c445e..b5f1a3ec7 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1150,13 +1150,10 @@ void sub_810E984(u8 taskId) } } -/* Removing the NONMATCHING block will swap the roles of r4 and r5 throughout. -Could possibly be fixed by writing code which increases the amount of references to newPos, -or decreasing the amount of references to i.*/ bool8 sub_810EAC8(u8 prevMenuPos, u8 dpadInput) { - u8 i; - bool8 flag = 0; + u8 i, j; + bool8 flag = FALSE; u8 newPos = 0; if (gUnknown_0203925A < 5) { @@ -1167,7 +1164,7 @@ bool8 sub_810EAC8(u8 prevMenuPos, u8 dpadInput) if (prevMenuPos == 0) { newPos = gUnknown_0203925B; - flag = 1; + flag = TRUE; } } else if (dpadInput == DPAD_DOWN) @@ -1175,21 +1172,17 @@ bool8 sub_810EAC8(u8 prevMenuPos, u8 dpadInput) if (prevMenuPos == 4) { newPos = gUnknown_0203925B - 4; - flag = 1; + flag = TRUE; } } if (flag) { sub_810EB90(newPos, 5); Menu_BlankWindowRect(2, 1, 7, 10); - for (i=0; i<5 && gUnknown_03000760[newPos].var0 != 16; newPos++, i++) + for (j = newPos, i=0; i<5; j++, i++) { - Menu_PrintText(gUnknown_083F8380[gUnknown_03000760[newPos].var0], 1, i * 2 + 1); -#ifndef NONMATCHING - asm(""::"r"(newPos)); - asm(""::"r"(newPos)); - asm(""::"r"(newPos)); -#endif + if (gUnknown_03000760[j].var0 == 16) break; // Has to be one line to match + Menu_PrintText(gUnknown_083F8380[gUnknown_03000760[j].var0], 1, i * 2 + 1); } } return flag; @@ -1513,8 +1506,8 @@ Could possibly be fixed by writing code which increases the amount of references or decreasing the amount of references to i.*/ bool8 sub_810F1F4(u8 prevCursorPos, u8 dpadInput) { - u8 i; - u8 flag = 0; + u8 i, j; + bool8 flag = FALSE; u8 newPos = 0; if (gUnknown_0203925A < 5) { @@ -1540,14 +1533,9 @@ bool8 sub_810F1F4(u8 prevCursorPos, u8 dpadInput) { GlassWorkshopUpdateScrollIndicators(newPos, 5); Menu_BlankWindowRect(2, 1, 9, 10); - for (i=0; i<5; newPos++, i++) + for (j = newPos, i=0; i<5; j++, i++) { - Menu_PrintText(gUnknown_083F83C0[newPos], 1, 2 * i + 1); -#ifndef NONMATCHING - asm(""::"r"(newPos)); - asm(""::"r"(newPos)); - asm(""::"r"(newPos)); -#endif + Menu_PrintText(gUnknown_083F83C0[j], 1, 2 * i + 1); } } return flag;