From afcb30ccb037c1f25bc45b9b376e3331ab158352 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 26 Oct 2017 22:54:11 -0400 Subject: [PATCH] sub_80EA354 --- asm/secret_base.s | 62 ----------------------------------------------- src/secret_base.c | 18 ++++++++++++++ 2 files changed, 18 insertions(+), 62 deletions(-) diff --git a/asm/secret_base.s b/asm/secret_base.s index 4027dda1a0..4915d8f153 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,68 +5,6 @@ .text - thumb_func_start sub_80EA354 -sub_80EA354: @ 80EA354 - push {r4-r7,lr} - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x00000922 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080EA39A - movs r3, 0 - ldr r7, =gSaveBlock1Ptr - ldr r4, =0x00001a9d - movs r6, 0x21 - negs r6, r6 -_080EA376: - ldr r1, [r7] - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 5 - adds r1, r0 - adds r1, r4 - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x13 - bls _080EA376 - ldr r0, =0x00000922 - bl FlagSet -_080EA39A: - ldr r4, =gSpecialVar_0x8004 - lsls r0, r5, 24 - lsrs r0, 24 - bl sub_80EA20C - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldr r2, =gScriptResult - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 5 - adds r1, r0 - ldr r0, =0x00001a9d - adds r1, r0 - ldrb r0, [r1] - lsls r0, 26 - lsrs r0, 31 - strh r0, [r2] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EA354 - thumb_func_start sub_80EA3E4 sub_80EA3E4: @ 80EA3E4 push {r4-r6,lr} diff --git a/src/secret_base.c b/src/secret_base.c index 68a663cfeb..175ad890db 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1269,3 +1269,21 @@ void sub_80EA30C(void) { gSaveBlock1Ptr->secretBases[VarGet(VAR_0x4054)].sbr_field_1_5 = gScriptResult; } + +void sub_80EA354(void) +{ + u16 sbId; + u8 i; + + sbId = VarGet(VAR_0x4054); + if (!FlagGet(0x922)) + { + for (i = 0; i < 20; i ++) + { + gSaveBlock1Ptr->secretBases[i].sbr_field_1_5 = FALSE; + } + FlagSet(0x922); + } + gSpecialVar_0x8004 = sub_80EA20C(sbId); + gScriptResult = gSaveBlock1Ptr->secretBases[sbId].sbr_field_1_5; +}