through sub_818E570

This commit is contained in:
PikalaxALT 2017-09-20 16:32:37 -04:00
parent d22a9acc63
commit 44e75e1f03
2 changed files with 56 additions and 161 deletions

View File

@ -5,167 +5,6 @@
.text
thumb_func_start sub_818E4A4
sub_818E4A4: @ 818E4A4
push {r4-r6,lr}
ldr r2, =gUnknown_0203CD68
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x00003b58
adds r0, r1
str r0, [r2]
ldr r1, =gScriptItemId
ldrh r1, [r1]
strh r1, [r0, 0x28]
movs r3, 0
adds r4, r2, 0
ldr r6, =gSaveBlock2Ptr
adds r5, r4, 0
adds r2, r6, 0
_0818E4C2:
ldr r1, [r5]
lsls r0, r3, 1
adds r1, 0x20
adds r1, r0
ldr r0, [r2]
adds r0, 0xA
adds r0, r3
ldrb r0, [r0]
strh r0, [r1]
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0818E4C2
ldr r0, [r4]
adds r0, 0x18
ldr r1, [r6]
bl StringCopy7
ldr r0, [r4]
ldr r1, =gGameLanguage
ldrb r1, [r1]
adds r0, 0x2D
strb r1, [r0]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_818E4A4
thumb_func_start sub_818E510
sub_818E510: @ 818E510
ldr r2, =gUnknown_0203CD68
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r3, =0x00003b58
adds r1, r0, r3
str r1, [r2]
ldr r1, =0x00003b82
adds r0, r1
movs r1, 0x1
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_818E510
thumb_func_start sub_818E538
sub_818E538: @ 818E538
push {lr}
ldr r2, =gUnknown_0203CD68
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
ldr r0, =0x00003b58
adds r1, r0
str r1, [r2]
ldr r0, =gStringVar3
ldrh r1, [r1, 0x14]
bl CopyEasyChatWord
pop {r0}
bx r0
.pool
thumb_func_end sub_818E538
thumb_func_start sub_818E564
sub_818E564: @ 818E564
push {lr}
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_818E564
thumb_func_start sub_818E570
sub_818E570: @ 818E570
push {r4-r7,lr}
ldr r2, =gUnknown_0203CD68
ldr r1, =gSaveBlock1Ptr
ldr r1, [r1]
ldr r4, =0x00003b58
adds r3, r1, r4
str r3, [r2]
adds r6, r0, 0
adds r6, 0x2C
ldrb r4, [r6]
adds r7, r2, 0
cmp r4, 0xF
bhi _0818E5EC
ldrb r0, [r3]
cmp r0, 0
bne _0818E5EC
movs r5, 0
ldr r2, =0x00003b83
adds r0, r1, r2
ldrb r0, [r0]
cmp r4, r0
bne _0818E5E4
adds r4, r7, 0
_0818E59E:
bl Random
ldr r2, [r4]
lsls r0, 16
lsrs r0, 16
movs r1, 0xF
ands r0, r1
adds r2, 0x2B
strb r0, [r2]
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x3
bhi _0818E5C6
ldr r0, [r4]
adds r0, 0x2B
ldrb r1, [r6]
ldrb r0, [r0]
cmp r1, r0
beq _0818E59E
_0818E5C6:
ldr r0, [r4]
adds r2, r0, 0
adds r2, 0x2B
ldrb r0, [r6]
ldr r7, =gUnknown_0203CD68
ldrb r4, [r2]
cmp r0, r4
bne _0818E5E4
ldrb r1, [r2]
adds r3, r1, 0x1
adds r0, r3, 0
asrs r0, 4
lsls r0, 4
subs r0, r3, r0
strb r0, [r2]
_0818E5E4:
ldr r0, [r7]
ldrb r1, [r6]
adds r0, 0x2C
strb r1, [r0]
_0818E5EC:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_818E570
thumb_func_start sub_818E604
sub_818E604: @ 818E604
push {r4,lr}

View File

@ -38,6 +38,8 @@ extern const u8 gUnknown_085EEB7E[8];
EWRAM_DATA struct LilycoveLadyFavour *gUnknown_0203CD64 = NULL;
EWRAM_DATA struct LilycoveLadyQuiz *gUnknown_0203CD68 = NULL;
EWRAM_DATA struct LilycoveLadyContest *gUnknown_0203CD6C = NULL;
extern EWRAM_DATA u16 gScriptItemId;
u8 GetLilycoveLadyId(void)
@ -659,3 +661,57 @@ void sub_818E490(void)
{
RemoveBagItem(gScriptItemId, 1);
}
void sub_818E4A4(void)
{
u8 i;
gUnknown_0203CD68 = &gSaveBlock1Ptr->lilycoveLady.quiz;
gUnknown_0203CD68->itemId = gScriptItemId;
for (i = 0; i < 4; i ++)
{
gUnknown_0203CD68->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
}
StringCopy7(gUnknown_0203CD68->playerName, gSaveBlock2Ptr->playerName);
gUnknown_0203CD68->language = gGameLanguage;
}
void sub_818E510(void)
{
gUnknown_0203CD68 = &gSaveBlock1Ptr->lilycoveLady.quiz;
gUnknown_0203CD68->unk_02a = 1;
}
void sub_818E538(void)
{
gUnknown_0203CD68 = &gSaveBlock1Ptr->lilycoveLady.quiz;
CopyEasyChatWord(gStringVar3, gUnknown_0203CD68->unk_014);
}
void sub_818E564(void)
{
EnableBothScriptContexts();
}
void sub_818E570(const struct LilycoveLadyQuiz *quiz)
{
u8 i;
gUnknown_0203CD68 = &gSaveBlock1Ptr->lilycoveLady.quiz;
if (quiz->unk_02c < 16 && gUnknown_0203CD68->id == LILYCOVE_LADY_QUIZ)
{
for (i = 0; i < 4; i ++)
{
if (quiz->unk_02c != gUnknown_0203CD68->unk_02b)
{
break;
}
gUnknown_0203CD68->unk_02b = Random() % 16;
}
if (quiz->unk_02c == gUnknown_0203CD68->unk_02b)
{
gUnknown_0203CD68->unk_02b = (gUnknown_0203CD68->unk_02b + 1) % 16;
}
gUnknown_0203CD68->unk_02c = quiz->unk_02c;
}
}