sub_8018B08

This commit is contained in:
PikalaxALT 2019-03-31 10:33:27 -04:00 committed by huderlem
parent 82a3f29b88
commit 608a217240
2 changed files with 62 additions and 146 deletions

View File

@ -5,151 +5,6 @@
.text
thumb_func_start sub_8018B08
sub_8018B08: @ 8018B08
push {r4-r6,lr}
sub sp, 0x1C
adds r5, r0, 0
adds r4, r1, 0
adds r1, r3, 0
lsls r2, 24
lsrs r6, r2, 24
ldrb r0, [r5]
cmp r0, 0x1
beq _08018B98
cmp r0, 0x1
bgt _08018B26
cmp r0, 0
beq _08018B30
b _08018C3E
_08018B26:
cmp r0, 0x2
beq _08018BE4
cmp r0, 0xFF
beq _08018C1A
b _08018C3E
_08018B30:
ldr r0, =gStringVar4
bl StringExpandPlaceholders
cmp r6, 0
bne _08018B48
ldr r0, =gUnknown_082F05C8
b _08018B4A
.pool
_08018B48:
ldr r0, =gUnknown_082F05D0
_08018B4A:
bl AddWindow
strh r0, [r4]
ldrb r0, [r4]
movs r1, 0x11
bl FillWindowPixelBuffer
ldrb r0, [r4]
movs r2, 0
str r2, [sp]
str r2, [sp, 0x4]
ldr r1, =gUnknown_082F0728
str r1, [sp, 0x8]
str r2, [sp, 0xC]
ldr r1, =gStringVar4
str r1, [sp, 0x10]
movs r1, 0x1
movs r3, 0x1
bl AddTextPrinterParameterized4
ldrb r0, [r4]
movs r1, 0x1
movs r2, 0xF
bl sub_8098858
ldrb r0, [r4]
movs r1, 0x2
bl CopyWindowToVram
ldrb r0, [r4]
bl PutWindowTilemap
b _08018BD6
.pool
_08018B98:
ldr r0, =gUnknown_082F05E8
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [sp, 0x14]
str r1, [sp, 0x18]
cmp r6, 0
bne _08018BBC
ldr r0, =0xff00ffff
ldr r1, [sp, 0x14]
ands r1, r0
movs r0, 0x90
lsls r0, 12
b _08018BC6
.pool
_08018BBC:
ldr r0, =0xff00ffff
ldr r1, [sp, 0x14]
ands r1, r0
movs r0, 0xF0
lsls r0, 12
_08018BC6:
orrs r1, r0
str r1, [sp, 0x14]
add r0, sp, 0x14
movs r1, 0xA
movs r2, 0xE
movs r3, 0
bl CreateYesNoMenu
_08018BD6:
ldrb r0, [r5]
adds r0, 0x1
strb r0, [r5]
b _08018C3E
.pool
_08018BE4:
bl Menu_ProcessInputNoWrapClearOnChoose
lsls r0, 24
asrs r6, r0, 24
movs r1, 0x80
lsls r1, 17
adds r0, r1
lsrs r0, 24
cmp r0, 0x2
bhi _08018C3E
movs r0, 0
strb r0, [r5]
ldrb r0, [r4]
bl rbox_fill_rectangle
ldrb r0, [r4]
bl ClearWindowTilemap
ldrb r0, [r4]
movs r1, 0x1
bl CopyWindowToVram
ldrb r0, [r4]
bl RemoveWindow
adds r0, r6, 0
b _08018C42
_08018C1A:
movs r0, 0
strb r0, [r5]
ldrb r0, [r4]
bl rbox_fill_rectangle
ldrb r0, [r4]
bl ClearWindowTilemap
ldrb r0, [r4]
movs r1, 0x1
bl CopyWindowToVram
ldrb r0, [r4]
bl RemoveWindow
movs r0, 0x1
negs r0, r0
b _08018C42
_08018C3E:
movs r0, 0x2
negs r0, r0
_08018C42:
add sp, 0x1C
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8018B08
thumb_func_start sub_8018C4C
sub_8018C4C: @ 8018C4C
push {r4-r6,lr}

View File

@ -598,7 +598,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str)
}
}
s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2)
s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2)
{
struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638;
struct WindowTemplate windowTemplate = gUnknown_082F05E0;
@ -635,3 +635,64 @@ s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2)
}
return r4;
}
s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str)
{
struct WindowTemplate windowTemplate;
s8 input;
switch (*textState)
{
case 0:
StringExpandPlaceholders(gStringVar4, str);
if (r6 == 0)
{
*windowId = AddWindow(&gUnknown_082F05C8);
}
else
{
*windowId = AddWindow(&gUnknown_082F05D0);
}
FillWindowPixelBuffer(*windowId, 0x11);
AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4);
sub_8098858(*windowId, 0x001, 0x0F);
CopyWindowToVram(*windowId, 2);
PutWindowTilemap(*windowId);
(*textState)++;
break;
case 1:
windowTemplate = gUnknown_082F05E8;
if (r6 == 0)
{
windowTemplate.tilemapTop = 9;
}
else
{
windowTemplate.tilemapTop = 15;
}
CreateYesNoMenu(&windowTemplate, 10, 14, 0);
(*textState)++;
break;
case 2:
input = Menu_ProcessInputNoWrapClearOnChoose();
if (input == -1 || input == 0 || input == 1)
{
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
RemoveWindow(*windowId);
return input;
}
break;
case 0xFF:
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
RemoveWindow(*windowId);
return -1;
}
return -2;
}