sub_818DB20

This commit is contained in:
scnorton 2017-09-19 16:32:33 -04:00
parent 0d0532731f
commit b26eb6713b
3 changed files with 22 additions and 46 deletions

View File

@ -5,48 +5,6 @@
.text .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 thumb_func_start SetLilycoveFavourLady
SetLilycoveFavourLady: @ 818DB7C SetLilycoveFavourLady: @ 818DB7C
push {lr} push {lr}

View File

@ -672,7 +672,11 @@ typedef union // TODO
struct struct
{ {
/*0x000*/ u8 id; /*0x000*/ u8 id;
} flavor; /*0x001*/ u8 filler_001[11];
/*0x00c*/ u8 unk_00c;
/*0x00d*/ u8 filler_00d[3];
/*0x010*/ u16 unk_010;
} favour;
struct struct
{ {

View File

@ -14,8 +14,11 @@ void sub_818E004(void);
void sub_818DBC4(void); void sub_818DBC4(void);
void sub_818E674(void); void sub_818E674(void);
extern const u16 gUnknown_0860B074[]; extern const u16 gUnknown_0860B074[5];
extern const u16 gUnknown_0860B07E[]; extern const u16 gUnknown_0860B07E[3];
extern const u16 *const gUnknown_0860B2EC[6];
EWRAM_DATA LilycoveLady *gUnknown_0203CD64 = NULL;
u8 GetLilycoveLadyId(void) u8 GetLilycoveLadyId(void)
{ {
@ -100,10 +103,21 @@ void sub_818DAEC(void)
gScriptResult = GetLilycoveLadyId(); gScriptResult = GetLilycoveLadyId();
} }
u8 sub_818DB04(u16 *data) u8 sub_818DB04(const u16 *data)
{ {
u8 len; u8 len;
for (len = 0; *data != 0; len ++, data ++); for (len = 0; *data != 0; len ++, data ++);
return len; 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];
}