From 534dd2c4b0259f87657b2e8795d96217e8bf12cc Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 19 Sep 2017 21:47:15 -0400 Subject: [PATCH] sub_818DD84 --- asm/lilycove_lady.s | 109 -------------------------------------------- include/item_menu.h | 11 +++++ src/lilycove_lady.c | 44 ++++++++++++++++++ 3 files changed, 55 insertions(+), 109 deletions(-) create mode 100644 include/item_menu.h diff --git a/asm/lilycove_lady.s b/asm/lilycove_lady.s index c2a6167a6..c4cc3d21a 100644 --- a/asm/lilycove_lady.s +++ b/asm/lilycove_lady.s @@ -5,115 +5,6 @@ .text - thumb_func_start sub_818DD54 -sub_818DD54: @ 818DD54 - ldr r1, =gUnknown_0203CD64 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003b58 - adds r0, r2 - str r0, [r1] - ldrb r1, [r0, 0x2] - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_818DD54 - - thumb_func_start sub_818DD78 -sub_818DD78: @ 818DD78 - push {lr} - bl sub_81AAC50 - pop {r0} - bx r0 - thumb_func_end sub_818DD78 - - thumb_func_start sub_818DD84 -sub_818DD84: @ 818DD84 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r5, r0, 16 - ldr r4, =gUnknown_0203CD64 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003b58 - adds r0, r1 - str r0, [r4] - ldr r1, =gUnknown_0860B2EC - mov r8, r1 - ldrb r0, [r0, 0xC] - lsls r0, 2 - add r0, r8 - ldr r0, [r0] - bl sub_818DB04 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, [r4] - movs r0, 0x1 - strb r0, [r1, 0x1] - ldr r0, =gStringVar2 - adds r1, r5, 0 - bl sub_818DCAC - ldr r1, [r4] - strh r5, [r1, 0xE] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - adds r1, 0x4 - bl sub_818DCF4 - ldr r1, [r4] - ldr r0, =gGameLanguage - ldrb r0, [r0] - strb r0, [r1, 0x12] - movs r7, 0 - movs r3, 0 - cmp r7, r6 - bcs _0818DE36 - mov r12, r8 -_0818DDDC: - ldr r2, [r4] - ldrb r0, [r2, 0xC] - lsls r0, 2 - add r0, r12 - ldr r1, [r0] - lsls r0, r3, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r5 - bne _0818DE28 - movs r7, 0x1 - ldrb r0, [r2, 0x3] - adds r0, 0x1 - strb r0, [r2, 0x3] - ldr r0, [r4] - strb r7, [r0, 0x2] - ldr r1, [r4] - ldrh r0, [r1, 0x10] - cmp r0, r5 - bne _0818DE36 - movs r0, 0x5 - strb r0, [r1, 0x3] - b _0818DE36 - .pool -_0818DE28: - movs r0, 0 - strb r0, [r2, 0x2] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, r6 - bcc _0818DDDC -_0818DE36: - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_818DD84 - thumb_func_start sub_818DE44 sub_818DE44: @ 818DE44 push {lr} diff --git a/include/item_menu.h b/include/item_menu.h new file mode 100644 index 000000000..f402f5cdd --- /dev/null +++ b/include/item_menu.h @@ -0,0 +1,11 @@ +#ifndef GUARD_item_menu_H +#define GUARD_item_menu_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +void sub_81AAC50(void); + +#endif //GUARD_item_menu_H diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index c6b49e36f..8a0851110 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -9,6 +9,7 @@ #include "string_util.h" #include "item.h" #include "items.h" +#include "item_menu.h" #include "text.h" #include "lilycove_lady.h" @@ -211,3 +212,46 @@ void sub_818DD14(void) sub_818DCF4(gSaveBlock1Ptr->lilycoveLady.favour.unk_004, gStringVar3); ConvertInternationalString(gStringVar3, gUnknown_0203CD64->favour.language); } + +bool8 sub_818DD54(void) +{ + gUnknown_0203CD64 = &gSaveBlock1Ptr->lilycoveLady; + return gUnknown_0203CD64->favour.unk_002 ? TRUE : FALSE; +} + +void sub_818DD78(void) +{ + sub_81AAC50(); +} + +bool8 sub_818DD84(u16 itemId) +{ + u8 len; + u8 i; + bool8 response; + + gUnknown_0203CD64 = &gSaveBlock1Ptr->lilycoveLady; + len = sub_818DB04(gUnknown_0860B2EC[gUnknown_0203CD64->favour.unk_00c]); + gUnknown_0203CD64->favour.unk_001 = 1; + sub_818DCAC(gStringVar2, itemId); + gUnknown_0203CD64->favour.itemId = itemId; + sub_818DCF4(gSaveBlock2Ptr->playerName, gUnknown_0203CD64->favour.unk_004); + gUnknown_0203CD64->favour.language = gGameLanguage; + response = FALSE; + for (i = 0; i < len; i ++) + { + if (gUnknown_0860B2EC[gUnknown_0203CD64->favour.unk_00c][i] == itemId) + { + response = TRUE; + gUnknown_0203CD64->favour.unk_003 ++; + gUnknown_0203CD64->favour.unk_002 = 1; + if (gUnknown_0203CD64->favour.unk_010 == itemId) + { + gUnknown_0203CD64->favour.unk_003 = 5; + } + break; + } + gUnknown_0203CD64->favour.unk_002 = 0; + } + return response; +}