through sub_80E9668

This commit is contained in:
PikalaxALT 2017-10-25 08:22:36 -04:00
parent 2dee40a23f
commit 835a04ada8
3 changed files with 31 additions and 86 deletions

View File

@ -5,92 +5,6 @@
.text
thumb_func_start sub_80E95D4
sub_80E95D4: @ 80E95D4
push {r4,r5,lr}
ldr r5, =0x0000401f
ldr r4, =gUnknown_0858D060
ldr r0, =0x00004054
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sub_80EA20C
lsls r0, 24
lsrs r0, 24
adds r0, r4
ldrb r1, [r0]
adds r0, r5, 0
bl VarSet
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E95D4
thumb_func_start sub_80E9608
sub_80E9608: @ 80E9608
push {r4-r6,lr}
adds r5, r0, 0
adds r4, r1, 0
movs r3, 0
ldrb r0, [r4, 0x3]
cmp r3, r0
bge _080E9660
ldr r6, =sCurSecretBaseId
_080E9618:
lsls r3, 16
asrs r1, r3, 16
ldr r2, [r4, 0x10]
lsls r0, r1, 1
adds r0, r1
lsls r0, 2
adds r2, r0, r2
ldrb r0, [r2, 0x5]
cmp r0, 0x8
bne _080E9650
movs r0, 0
ldrsh r1, [r5, r0]
ldrh r0, [r2]
adds r0, 0x7
cmp r1, r0
bne _080E9650
movs r0, 0x2
ldrsh r1, [r5, r0]
ldrh r0, [r2, 0x2]
adds r0, 0x7
cmp r1, r0
bne _080E9650
ldr r0, [r2, 0x8]
strb r0, [r6]
b _080E9660
.pool
_080E9650:
movs r1, 0x80
lsls r1, 9
adds r0, r3, r1
lsrs r3, r0, 16
asrs r0, 16
ldrb r1, [r4, 0x3]
cmp r0, r1
blt _080E9618
_080E9660:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_80E9608
thumb_func_start sub_80E9668
sub_80E9668: @ 80E9668
push {lr}
bl sub_80E9608
bl sub_80E8B6C
ldr r0, =gUnknown_08275BB7
bl ScriptContext1_SetupScript
pop {r0}
bx r0
.pool
thumb_func_end sub_80E9668
thumb_func_start sub_80E9680
sub_80E9680: @ 80E9680
push {lr}

View File

@ -6,6 +6,7 @@
#define GUARD_EVENT_SCRIPTS_H
extern const u8 gUnknown_0823B4E8[];
extern const u8 gUnknown_08275BB7[];
extern const u8 gUnknown_08275D0C[];
extern const u8 gUnknown_08275D1F[];
extern const u8 gUnknown_08275D2E[];

View File

@ -17,6 +17,7 @@
#include "text.h"
#include "string_util.h"
#include "script.h"
#include "event_scripts.h"
#include "event_data.h"
#include "decoration.h"
#include "decoration_inventory.h"
@ -36,6 +37,8 @@ EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
// Static ROM declarations
u8 sub_80EA20C(u8 sbId);
// .rodata
extern const struct {
@ -44,6 +47,7 @@ extern const struct {
} gUnknown_0858CFCC[7];
extern const u8 gUnknown_0858CFE8[];
extern const u8 gUnknown_0858D060[];
// .text
@ -486,3 +490,29 @@ void sub_80E9578(void)
}
}
}
void sub_80E95D4(void)
{
VarSet(VAR_0x401F, gUnknown_0858D060[sub_80EA20C(VarGet(VAR_0x4054))]);
}
void sub_80E9608(struct Coords16 *coords, struct MapEvents *events)
{
s16 bgevtidx;
for (bgevtidx = 0; bgevtidx < events->bgEventCount; bgevtidx ++)
{
if (events->bgEvents[bgevtidx].kind == 8 && coords->x == events->bgEvents[bgevtidx].x + 7 && coords->y == events->bgEvents[bgevtidx].y + 7)
{
sCurSecretBaseId = events->bgEvents[bgevtidx].bgUnion.secretBaseId;
break;
}
}
}
void sub_80E9668(struct Coords16 *coords, struct MapEvents *events)
{
sub_80E9608(coords, events);
sub_80E8B6C();
ScriptContext1_SetupScript(gUnknown_08275BB7);
}