WIP sub_8018DAC

This commit is contained in:
PikalaxALT 2019-03-31 11:16:19 -04:00 committed by huderlem
parent 608a217240
commit f88f815cff
6 changed files with 133 additions and 156 deletions

View File

@ -5,160 +5,6 @@
.text .text
thumb_func_start sub_8018C4C
sub_8018C4C: @ 8018C4C
push {r4-r6,lr}
sub sp, 0x14
adds r6, r0, 0
adds r5, r1, 0
ldrb r0, [r6]
cmp r0, 0x1
beq _08018CE8
cmp r0, 0x1
bgt _08018C64
cmp r0, 0
beq _08018C6C
b _08018D8C
_08018C64:
cmp r0, 0xFF
bne _08018C6A
b _08018D68
_08018C6A:
b _08018D8C
_08018C6C:
cmp r2, 0
bne _08018C84
ldr r0, =gStringVar4
ldr r1, =gText_WhatToDoWithCards
bl StringExpandPlaceholders
b _08018C8C
.pool
_08018C84:
ldr r0, =gStringVar4
ldr r1, =gText_WhatToDoWithNews
bl StringExpandPlaceholders
_08018C8C:
ldr r0, =gUnknown_082F05D8
bl AddWindow
strh r0, [r5]
lsls r0, 24
lsrs r0, 24
movs r1, 0x11
bl FillWindowPixelBuffer
ldrb r0, [r5]
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, [r5]
movs r1, 0x1
movs r2, 0xF
bl sub_8098858
ldrb r0, [r5]
movs r1, 0x2
bl CopyWindowToVram
ldrb r0, [r5]
bl PutWindowTilemap
ldrb r0, [r6]
adds r0, 0x1
strb r0, [r6]
b _08018D8C
.pool
_08018CE8:
cmp r3, 0
beq _08018D10
cmp r2, 0
bne _08018D00
ldr r0, =gUnknown_082F05F8
ldr r1, =gUnknown_082F06C8
b _08018D28
.pool
_08018D00:
ldr r0, =gUnknown_082F0600
ldr r1, =gUnknown_082F06F8
b _08018D28
.pool
_08018D10:
cmp r2, 0
bne _08018D24
ldr r0, =gUnknown_082F05F0
ldr r1, =gUnknown_082F06B0
b _08018D28
.pool
_08018D24:
ldr r0, =gUnknown_082F05F8
ldr r1, =gUnknown_082F06E0
_08018D28:
movs r2, 0xE0
str r2, [sp]
movs r2, 0x1
movs r3, 0xA
bl DoMysteryGiftListMenu
adds r4, r0, 0
movs r0, 0x1
negs r0, r0
cmp r4, r0
beq _08018D8C
movs r0, 0
strb r0, [r6]
ldrb r0, [r5]
bl rbox_fill_rectangle
ldrb r0, [r5]
bl ClearWindowTilemap
ldrb r0, [r5]
movs r1, 0x1
bl CopyWindowToVram
ldrb r0, [r5]
bl RemoveWindow
adds r0, r4, 0
b _08018D90
.pool
_08018D68:
movs r0, 0
strb r0, [r6]
ldrb r0, [r5]
bl rbox_fill_rectangle
ldrb r0, [r5]
bl ClearWindowTilemap
ldrb r0, [r5]
movs r1, 0x1
bl CopyWindowToVram
ldrb r0, [r5]
bl RemoveWindow
movs r0, 0x2
negs r0, r0
b _08018D90
_08018D8C:
movs r0, 0x1
negs r0, r0
_08018D90:
add sp, 0x14
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8018C4C
thumb_func_start sub_8018D98
sub_8018D98: @ 8018D98
push {lr}
cmp r0, 0
beq _08018DA4
bl sub_801B0CC
b _08018DA8
_08018DA4:
bl sub_801B27C
_08018DA8:
pop {r1}
bx r1
thumb_func_end sub_8018D98
thumb_func_start sub_8018DAC thumb_func_start sub_8018DAC
sub_8018DAC: @ 8018DAC sub_8018DAC: @ 8018DAC
push {r4,r5,lr} push {r4,r5,lr}

View File

@ -98,7 +98,7 @@ struct CursorStruct
extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ScrollArrowsTemplate gTempScrollArrowTemplate;
extern struct ListMenuTemplate gMultiuseListMenuTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate;
s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum);
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow);
s32 ListMenu_ProcessInput(u8 listTaskId); s32 ListMenu_ProcessInput(u8 listTaskId);

9
include/mevent_801BAAC.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef GUARD_MEVENT_801BAAC_H
#define GUARD_MEVENT_801BAAC_H
bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6);
bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0);
s32 sub_801BB74(void);
s32 sub_801C758(void);
#endif //GUARD_MEVENT_801BAAC_H

View File

@ -2626,5 +2626,7 @@ extern const u8 gText_VarietyOfEventsImportedWireless[];
extern const u8 gText_WonderCardsInPossession[]; extern const u8 gText_WonderCardsInPossession[];
extern const u8 gText_ReadNewsThatArrived[]; extern const u8 gText_ReadNewsThatArrived[];
extern const u8 gText_ReturnToTitle[]; extern const u8 gText_ReturnToTitle[];
extern const u8 gText_WhatToDoWithCards[];
extern const u8 gText_WhatToDoWithNews[];
#endif // GUARD_STRINGS_H #endif // GUARD_STRINGS_H

View File

@ -312,7 +312,7 @@ static void ListMenuDummyTask(u8 taskId)
} }
s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum)
{ {
switch (sMysteryGiftLinkMenu.state) switch (sMysteryGiftLinkMenu.state)
{ {

View File

@ -21,6 +21,8 @@
#include "international_string_util.h" #include "international_string_util.h"
#include "list_menu.h" #include "list_menu.h"
#include "string_util.h" #include "string_util.h"
#include "mevent.h"
#include "mevent_801BAAC.h"
void bgid_upload_textbox_1(u8 bgId); void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void); void task_add_00_mystery_gift(void);
@ -696,3 +698,121 @@ s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str)
return -2; return -2;
} }
s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3)
{
struct WindowTemplate windowTemplate;
s32 input;
switch (*textState)
{
case 0:
if (r2 == 0)
{
StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithCards);
}
else
{
StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithNews);
}
*windowId = AddWindow(&gUnknown_082F05D8);
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 (r3)
{
if (r2 == 0)
{
input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06C8, 1, 0x00A, 0xE0);
}
else
{
input = DoMysteryGiftListMenu(&gUnknown_082F0600, &gUnknown_082F06F8, 1, 0x00A, 0xE0);
}
}
else
{
if (r2 == 0)
{
input = DoMysteryGiftListMenu(&gUnknown_082F05F0, &gUnknown_082F06B0, 1, 0x00A, 0xE0);
}
else
{
input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06E0, 1, 0x00A, 0xE0);
}
}
if (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 -2;
}
return -1;
}
s32 sub_8018D98(bool32 a0)
{
if (a0 == 0)
{
return sub_801B27C();
}
else
{
return sub_801B0CC();
}
}
/*bool32 sub_8018DAC(u8 * state, bool32 arg1)
{
switch (*state)
{
case 0:
if (arg1 == 0)
{
sub_801BAAC(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2());
}
else
{
sub_801C6C8(sub_801B00C());
}
(*state)++;
case 1:
if (arg1 == 0)
{
if (sub_801BB74() == 0)
{
break;
}
}
else
{
if (sub_801C758() == 0)
{
break;
}
}
*state = 0;
return TRUE;
}
return FALSE;
}*/