From 316f9f4d83d118437c266526cc0e6da1dfc90461 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 19 Sep 2017 21:28:01 -0400 Subject: [PATCH] through sub_818DD14 --- asm/lilycove_lady.s | 73 --------------------------------------------- include/global.h | 2 +- src/lilycove_lady.c | 28 ++++++++++++++++- 3 files changed, 28 insertions(+), 75 deletions(-) diff --git a/asm/lilycove_lady.s b/asm/lilycove_lady.s index 75f9458a3..c2a6167a6 100644 --- a/asm/lilycove_lady.s +++ b/asm/lilycove_lady.s @@ -5,79 +5,6 @@ .text - thumb_func_start sub_818DCAC -sub_818DCAC: @ 818DCAC - push {r4,lr} - adds r4, r0, 0 - lsls r0, r1, 16 - lsrs r0, 16 - bl ItemId_GetItem - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818DCAC - - thumb_func_start sub_818DCC8 -sub_818DCC8: @ 818DCC8 - push {lr} - ldr r2, =gUnknown_0203CD64 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00003b58 - adds r1, r0 - str r1, [r2] - ldr r0, =gStringVar2 - ldrh r1, [r1, 0xE] - bl sub_818DCAC - pop {r0} - bx r0 - .pool - thumb_func_end sub_818DCC8 - - thumb_func_start sub_818DCF4 -sub_818DCF4: @ 818DCF4 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - adds r0, r4, 0 - movs r1, 0xFF - movs r2, 0x8 - bl memset - adds r0, r4, 0 - adds r1, r5, 0 - bl StringCopy7 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_818DCF4 - - thumb_func_start sub_818DD14 -sub_818DD14: @ 818DD14 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CD64 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003b58 - adds r1, r0, r2 - str r1, [r5] - ldr r1, =0x00003b5c - adds r0, r1 - ldr r4, =gStringVar3 - adds r1, r4, 0 - bl sub_818DCF4 - ldr r0, [r5] - ldrb r1, [r0, 0x12] - adds r0, r4, 0 - bl ConvertInternationalString - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_818DD14 - thumb_func_start sub_818DD54 sub_818DD54: @ 818DD54 ldr r1, =gUnknown_0203CD64 diff --git a/include/global.h b/include/global.h index 64ed869ef..8c2122b39 100644 --- a/include/global.h +++ b/include/global.h @@ -684,7 +684,7 @@ typedef union // TODO /*0x004*/ u8 unk_004[8]; /*0x00c*/ u8 unk_00c; /*0x00d*/ u8 filler_00d; - /*0x00e*/ u16 unk_00e; + /*0x00e*/ u16 itemId; /*0x010*/ u16 unk_010; /*0x012*/ u8 language; } favour; diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 578280115..c6b49e36f 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -7,6 +7,8 @@ #include "event_data.h" #include "rng.h" #include "string_util.h" +#include "item.h" +#include "items.h" #include "text.h" #include "lilycove_lady.h" @@ -134,7 +136,7 @@ void SetLilycoveFavourLady(void) gUnknown_0203CD64->favour.unk_004[0] = EOS; gUnknown_0203CD64->favour.unk_002 = 0; gUnknown_0203CD64->favour.unk_003= 0; - gUnknown_0203CD64->favour.unk_00e = 0; + gUnknown_0203CD64->favour.itemId = ITEM_NONE; gUnknown_0203CD64->favour.language = gGameLanguage; sub_818DB20(); } @@ -185,3 +187,27 @@ bool8 sub_818DC60(void) } return FALSE; } + +void sub_818DCAC(u8 *dest, u16 itemId) +{ + StringCopy(dest, ItemId_GetItem(itemId)->name); +} + +void sub_818DCC8(void) +{ + gUnknown_0203CD64 = &gSaveBlock1Ptr->lilycoveLady; + sub_818DCAC(gStringVar2, gUnknown_0203CD64->favour.itemId); +} + +void sub_818DCF4(const u8 *src, u8 *dest) +{ + memset(dest, 0xFF, 8); + StringCopy7(dest, src); +} + +void sub_818DD14(void) +{ + gUnknown_0203CD64 = &gSaveBlock1Ptr->lilycoveLady; + sub_818DCF4(gSaveBlock1Ptr->lilycoveLady.favour.unk_004, gStringVar3); + ConvertInternationalString(gStringVar3, gUnknown_0203CD64->favour.language); +}