through sub_80E8BC8

This commit is contained in:
PikalaxALT 2017-10-23 19:21:08 -04:00
parent 0dfd0f8c0e
commit eb2c2f0a3f
3 changed files with 38 additions and 75 deletions

View file

@ -5,72 +5,6 @@
.text
thumb_func_start sub_80E8B6C
sub_80E8B6C: @ 80E8B6C
push {r4,lr}
ldr r0, =gScriptResult
movs r1, 0
strh r1, [r0]
movs r3, 0
adds r4, r0, 0
b _080E8B86
.pool
_080E8B80:
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
_080E8B86:
cmp r3, 0x13
bhi _080E8BB0
ldr r2, =gUnknown_0203A01C
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
lsls r0, r3, 2
adds r0, r3
lsls r0, 5
adds r1, r0
ldr r0, =0x00001a9c
adds r1, r0
ldrb r0, [r2]
ldrb r1, [r1]
cmp r0, r1
bne _080E8B80
movs r0, 0x1
strh r0, [r4]
ldr r0, =0x00004054
adds r1, r3, 0
bl VarSet
_080E8BB0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E8B6C
thumb_func_start sub_80E8BC8
sub_80E8BC8: @ 80E8BC8
push {lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x00001a9c
adds r0, r1
ldrb r1, [r0]
cmp r1, 0
beq _080E8BEC
ldr r1, =gScriptResult
movs r0, 0x1
strh r0, [r1]
b _080E8BF0
.pool
_080E8BEC:
ldr r0, =gScriptResult
strh r1, [r0]
_080E8BF0:
pop {r0}
bx r0
.pool
thumb_func_end sub_80E8BC8
thumb_func_start sub_80E8BF8
sub_80E8BF8: @ 80E8BF8
push {r4,lr}
@ -375,7 +309,7 @@ sub_80E8E18: @ 80E8E18
push {r6}
ldr r2, =gSaveBlock1Ptr
ldr r0, [r2]
ldr r1, =gUnknown_0203A01C
ldr r1, =sCurSecretBaseId
ldrb r1, [r1]
ldr r3, =0x00001a9c
adds r0, r3
@ -548,7 +482,7 @@ _080E8F8A:
thumb_func_start sub_80E8F9C
sub_80E8F9C: @ 80E8F9C
push {lr}
ldr r0, =gUnknown_0203A01C
ldr r0, =sCurSecretBaseId
ldrb r0, [r0]
movs r1, 0xA
bl __udivsi3
@ -767,7 +701,7 @@ sub_80E916C: @ 80E916C
ands r0, r1
cmp r0, 0
bne _080E91D4
ldr r0, =gUnknown_0203A01C
ldr r0, =sCurSecretBaseId
ldrb r0, [r0]
movs r1, 0xA
bl __udivsi3
@ -1302,7 +1236,7 @@ sub_80E9608: @ 80E9608
ldrb r0, [r4, 0x3]
cmp r3, r0
bge _080E9660
ldr r6, =gUnknown_0203A01C
ldr r6, =sCurSecretBaseId
_080E9618:
lsls r3, 16
asrs r1, r3, 16
@ -1456,7 +1390,7 @@ sub_80E9744: @ 80E9744
ldr r0, [r0]
ldr r1, =0x00001a9c
adds r0, r1
ldr r1, =gUnknown_0203A01C
ldr r1, =sCurSecretBaseId
ldrb r0, [r0]
ldrb r1, [r1]
cmp r0, r1

View file

@ -236,12 +236,12 @@ extern struct SaveBlock2 *gSaveBlock2Ptr;
struct SecretBaseRecord
{
/*ID?*/ /*0x1A9C*/ u8 sbr_field_0;
/*0x1A9C*/ u8 secretBaseId;
/*0x1A9D*/ u8 sbr_field_1_0:4;
/*0x1A9D*/ u8 gender:1;
/*0x1A9D*/ u8 sbr_field_1_5:1;
/*0x1A9D*/ u8 sbr_field_1_6:2;
/*0x1A9E*/ u8 trainerName[7]; // 0xFF bytes?
/*0x1A9E*/ u8 trainerName[OT_NAME_LENGTH];
/*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class
/*0x1AA9*/ u8 language;
/*0x1AAA*/ u16 sbr_field_e;

View file

@ -16,7 +16,7 @@ struct SecretBaseListMenuBuffer {
};
// Static RAM declarations
EWRAM_DATA u8 gUnknown_0203A01C = 0;
EWRAM_DATA u8 sCurSecretBaseId = 0;
EWRAM_DATA u8 gUnknown_0203A01D = 0;
EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
@ -45,7 +45,36 @@ void ResetSecretBases(void)
void sub_80E8B58(void)
{
gUnknown_0203A01C = gSpecialVar_0x8004;
sCurSecretBaseId = gSpecialVar_0x8004;
}
void sub_80E8B6C(void)
{
u16 i;
gScriptResult = FALSE;
for (i = 0; i < 20; i ++)
{
if (sCurSecretBaseId != gSaveBlock1Ptr->secretBases[i].secretBaseId)
{
continue;
}
gScriptResult = TRUE;
VarSet(VAR_0x4054, i);
break;
}
}
void sub_80E8BC8(void)
{
if (gSaveBlock1Ptr->secretBases[0].secretBaseId != 0)
{
gScriptResult = TRUE;
}
else
{
gScriptResult = FALSE;
}
}
// .rodata