Merge branch 'master' into frontier_2

This commit is contained in:
DizzyEggg 2018-11-12 15:42:44 +01:00
commit 734403fdfa

View File

@ -1245,7 +1245,6 @@ static void Task_HandleYesNoInput(u8 taskId)
EnableBothScriptContexts();
}
#ifdef NONMATCHING
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount)
{
u8 bottom = 0;
@ -1264,15 +1263,10 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr
gSpecialVar_Result = 0xFF;
width = 0;
i = 0;
if (width < gMultichoiceLists[multichoiceId].count)
for (i = 0; i < gMultichoiceLists[multichoiceId].count; i++)
{
do
{
width = display_text_and_get_width(gMultichoiceLists[multichoiceId].list[i].text, width);
i++;
} while (i < gMultichoiceLists[multichoiceId].count);
width = display_text_and_get_width(gMultichoiceLists[multichoiceId].list[i].text, width);
}
newWidth = convert_pixel_width_to_tile_width(width);
@ -1291,152 +1285,6 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr
return TRUE;
}
}
#else
NAKED
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount)
{
asm_unified(" push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x10\n\
ldr r4, [sp, 0x30]\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
lsls r1, 24\n\
lsrs r1, 24\n\
str r1, [sp, 0x4]\n\
lsls r2, 24\n\
lsrs r5, r2, 24\n\
lsls r3, 24\n\
lsrs r3, 24\n\
str r3, [sp, 0x8]\n\
lsls r4, 24\n\
lsrs r4, 24\n\
mov r10, r4\n\
ldr r0, =Task_HandleMultichoiceGridInput\n\
bl FuncIsActiveTask\n\
lsls r0, 24\n\
lsrs r0, 24\n\
cmp r0, 0x1\n\
bne _080E2210\n\
movs r0, 0\n\
b _080E22E8\n\
.pool\n\
_080E2210:\n\
ldr r0, =gSpecialVar_Result\n\
movs r1, 0xFF\n\
strh r1, [r0]\n\
movs r2, 0\n\
movs r6, 0\n\
ldr r1, =gMultichoiceLists\n\
lsls r5, 3\n\
adds r0, r5, r1\n\
str r5, [sp, 0xC]\n\
ldrb r0, [r0, 0x4]\n\
cmp r2, r0\n\
bge _080E2246\n\
mov r8, r1\n\
_080E222A:\n\
mov r0, r8\n\
adds r4, r5, r0\n\
ldr r1, [r4]\n\
lsls r0, r6, 3\n\
adds r0, r1\n\
ldr r0, [r0]\n\
adds r1, r2, 0\n\
bl display_text_and_get_width\n\
adds r2, r0, 0\n\
adds r6, 0x1\n\
ldrb r4, [r4, 0x4]\n\
cmp r6, r4\n\
blt _080E222A\n\
_080E2246:\n\
adds r0, r2, 0\n\
bl convert_pixel_width_to_tile_width\n\
adds r5, r0, 0\n\
lsls r5, 24\n\
lsrs r5, 24\n\
mov r1, r10\n\
muls r1, r5\n\
mov r8, r1\n\
adds r0, r7, 0\n\
bl sub_80E2D5C\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
ldr r2, =gMultichoiceLists\n\
mov r9, r2\n\
ldr r0, [sp, 0xC]\n\
add r9, r0\n\
mov r1, r9\n\
ldrb r0, [r1, 0x4]\n\
mov r1, r10\n\
bl __udivsi3\n\
adds r6, r0, 0\n\
lsls r6, 24\n\
lsrs r6, 24\n\
ldr r0, =Task_HandleMultichoiceGridInput\n\
movs r1, 0x50\n\
bl CreateTask\n\
lsls r0, 24\n\
lsrs r0, 24\n\
ldr r1, =gTasks\n\
lsls r4, r0, 2\n\
adds r4, r0\n\
lsls r4, 3\n\
adds r4, r1\n\
mov r2, sp\n\
ldrh r2, [r2, 0x8]\n\
strh r2, [r4, 0x10]\n\
mov r0, r8\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
lsls r3, r6, 25\n\
lsrs r3, 24\n\
adds r0, r7, 0\n\
ldr r1, [sp, 0x4]\n\
mov r2, r8\n\
bl CreateWindowFromRect\n\
lsls r0, 24\n\
lsrs r0, 24\n\
strh r0, [r4, 0x14]\n\
movs r1, 0\n\
bl SetStandardWindowBorderStyle\n\
ldrb r0, [r4, 0x14]\n\
lsls r5, 27\n\
lsrs r5, 24\n\
mov r2, r9\n\
ldr r1, [r2]\n\
str r1, [sp]\n\
adds r1, r5, 0\n\
mov r2, r10\n\
adds r3, r6, 0\n\
bl sub_81997AC\n\
ldrb r0, [r4, 0x14]\n\
movs r1, 0\n\
str r1, [sp]\n\
adds r1, r5, 0\n\
mov r2, r10\n\
adds r3, r6, 0\n\
bl sub_8199944\n\
ldrb r0, [r4, 0x14]\n\
movs r1, 0x3\n\
bl CopyWindowToVram\n\
movs r0, 0x1\n\
_080E22E8:\n\
add sp, 0x10\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
.pool");
}
#endif
static void Task_HandleMultichoiceGridInput(u8 taskId)
{