summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/lilycove_lady.s42
-rw-r--r--include/global.h6
-rw-r--r--src/lilycove_lady.c20
3 files changed, 22 insertions, 46 deletions
diff --git a/asm/lilycove_lady.s b/asm/lilycove_lady.s
index fbdcc10dd..83c6df670 100644
--- a/asm/lilycove_lady.s
+++ b/asm/lilycove_lady.s
@@ -5,48 +5,6 @@
.text
- thumb_func_start sub_818DB20
-sub_818DB20: @ 818DB20
- push {r4-r6,lr}
- bl Random
- ldr r5, =gUnknown_0203CD64
- ldr r4, [r5]
- lsls r0, 16
- lsrs r0, 16
- movs r1, 0x6
- bl __umodsi3
- strb r0, [r4, 0xC]
- ldr r6, =gUnknown_0860B2EC
- ldr r0, [r5]
- ldrb r0, [r0, 0xC]
- lsls r0, 2
- adds r0, r6
- ldr r0, [r0]
- bl sub_818DB04
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- bl Random
- lsls r0, 16
- lsrs r0, 16
- adds r1, r4, 0
- bl __modsi3
- lsls r0, 24
- ldr r2, [r5]
- ldrb r1, [r2, 0xC]
- lsls r1, 2
- adds r1, r6
- ldr r1, [r1]
- lsrs r0, 23
- adds r0, r1
- ldrh r0, [r0]
- strh r0, [r2, 0x10]
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_818DB20
-
thumb_func_start SetLilycoveFavourLady
SetLilycoveFavourLady: @ 818DB7C
push {lr}
diff --git a/include/global.h b/include/global.h
index 764eff563..92435ce28 100644
--- a/include/global.h
+++ b/include/global.h
@@ -672,7 +672,11 @@ typedef union // TODO
struct
{
/*0x000*/ u8 id;
- } flavor;
+ /*0x001*/ u8 filler_001[11];
+ /*0x00c*/ u8 unk_00c;
+ /*0x00d*/ u8 filler_00d[3];
+ /*0x010*/ u16 unk_010;
+ } favour;
struct
{
diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c
index 579eca5cb..2e0d336dd 100644
--- a/src/lilycove_lady.c
+++ b/src/lilycove_lady.c
@@ -14,8 +14,11 @@ void sub_818E004(void);
void sub_818DBC4(void);
void sub_818E674(void);
-extern const u16 gUnknown_0860B074[];
-extern const u16 gUnknown_0860B07E[];
+extern const u16 gUnknown_0860B074[5];
+extern const u16 gUnknown_0860B07E[3];
+extern const u16 *const gUnknown_0860B2EC[6];
+
+EWRAM_DATA LilycoveLady *gUnknown_0203CD64 = NULL;
u8 GetLilycoveLadyId(void)
{
@@ -100,10 +103,21 @@ void sub_818DAEC(void)
gScriptResult = GetLilycoveLadyId();
}
-u8 sub_818DB04(u16 *data)
+u8 sub_818DB04(const u16 *data)
{
u8 len;
for (len = 0; *data != 0; len ++, data ++);
return len;
}
+
+void sub_818DB20(void)
+{
+ u8 size;
+ u8 idx;
+
+ gUnknown_0203CD64->favour.unk_00c = Random() % 6;
+ size = sub_818DB04(gUnknown_0860B2EC[gUnknown_0203CD64->favour.unk_00c]);
+ idx = Random() % size;
+ gUnknown_0203CD64->favour.unk_010 = gUnknown_0860B2EC[gUnknown_0203CD64->favour.unk_00c][idx];
+}