sub_80E8EE0

This commit is contained in:
PikalaxALT 2017-10-24 20:37:38 -04:00
parent bd85d9166d
commit 45479c14b6
2 changed files with 35 additions and 98 deletions

View File

@ -5,104 +5,6 @@
.text
thumb_func_start sub_80E8EE0
sub_80E8EE0: @ 80E8EE0
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
mov r8, r0
movs r5, 0
b _080E8F8A
_080E8EEE:
mov r0, r8
ldr r1, [r0, 0x10]
lsls r2, r5, 1
adds r0, r2, r5
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0x5]
adds r6, r1, 0
adds r1, r5, 0x1
mov r9, r1
cmp r0, 0x8
bne _080E8F82
movs r4, 0
ldr r7, =gSaveBlock1Ptr
_080E8F0A:
ldr r1, [r7]
lsls r0, r4, 2
adds r0, r4
lsls r0, 5
adds r1, r0
ldr r0, =0x00001a9c
adds r1, r0
ldrb r1, [r1]
adds r0, r2, r5
lsls r0, 2
adds r3, r0, r6
ldr r0, [r3, 0x8]
cmp r1, r0
bne _080E8F78
ldrh r5, [r3]
adds r5, 0x7
ldrh r4, [r3, 0x2]
adds r4, 0x7
lsls r5, 16
asrs r0, r5, 16
lsls r4, 16
asrs r1, r4, 16
bl MapGridGetMetatileIdAt
movs r3, 0
lsls r0, 16
asrs r1, r0, 16
ldr r6, =gUnknown_0858CFCC
_080E8F42:
lsls r0, r3, 2
adds r2, r0, r6
ldrh r0, [r2]
cmp r0, r1
bne _080E8F6C
ldrh r0, [r2, 0x2]
movs r1, 0xC0
lsls r1, 4
adds r2, r1, 0
orrs r2, r0
asrs r0, r5, 16
asrs r1, r4, 16
bl MapGridSetMetatileIdAt
b _080E8F82
.pool
_080E8F6C:
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
cmp r3, 0x6
bls _080E8F42
b _080E8F82
_080E8F78:
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x13
bls _080E8F0A
_080E8F82:
mov r1, r9
lsls r0, r1, 16
lsrs r5, r0, 16
mov r0, r8
_080E8F8A:
ldrb r0, [r0, 0x3]
cmp r5, r0
bcc _080E8EEE
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80E8EE0
thumb_func_start sub_80E8F9C
sub_80E8F9C: @ 80E8F9C
push {lr}

View File

@ -295,3 +295,38 @@ void sub_80E8E18(void)
gSaveBlock1Ptr->secretBases[0].language = GAME_LANGUAGE;
VarSet(VAR_SECRET_BASE_MAP, gMapHeader.regionMapSectionId);
}
void sub_80E8EE0(struct MapEvents *events)
{
u16 bgevidx;
u16 idx;
u16 jdx;
s16 tile_id;
s16 x;
s16 y;
for (bgevidx = 0; bgevidx < events->bgEventCount; bgevidx ++)
{
if (events->bgEvents[bgevidx].kind == 8)
{
for (jdx = 0; jdx < 20; jdx ++)
{
if (gSaveBlock1Ptr->secretBases[jdx].secretBaseId == events->bgEvents[bgevidx].bgUnion.secretBaseId)
{
x = events->bgEvents[bgevidx].x + 7;
y = events->bgEvents[bgevidx].y + 7;
tile_id = MapGridGetMetatileIdAt(x, y);
for (idx = 0; idx < 7; idx ++)
{
if (gUnknown_0858CFCC[idx].tile1 == tile_id)
{
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[idx].tile2 | 0xc00);
break;
}
}
break;
}
}
}
}
}