From 69d206c2558b4df3b30712adfbbb45b2dd360d53 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 27 Oct 2017 22:24:54 -0400 Subject: [PATCH] sub_80EB498 --- asm/secret_base.s | 78 ----------------------------------------------- src/secret_base.c | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 78 deletions(-) diff --git a/asm/secret_base.s b/asm/secret_base.s index be3f5a231f..7ef007a81b 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,84 +5,6 @@ .text - thumb_func_start sub_80EB498 -sub_80EB498: @ 80EB498 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileIdAt - ldr r1, =0xfffffce4 - adds r0, r1 - cmp r0, 0x18 - bhi _080EB55C - lsls r0, 2 - ldr r1, =_080EB4D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080EB4D0: - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB55C - .4byte _080EB55C - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 - .4byte _080EB534 -_080EB534: - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080EB55C - ldr r4, =0x000040ee - adds r0, r4, 0 - bl VarGet - adds r1, r0, 0 - movs r2, 0x80 - lsls r2, 7 - adds r0, r2, 0 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl VarSet -_080EB55C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EB498 - thumb_func_start sub_80EB56C sub_80EB56C: @ 80EB56C push {r4,lr} diff --git a/src/secret_base.c b/src/secret_base.c index 59df479895..bbbf8bd312 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1992,3 +1992,34 @@ void sub_80EB438(void) VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x001); } } + +void sub_80EB498(void) +{ + s16 x; + s16 y; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + switch (MapGridGetMetatileIdAt(x, y)) + { + case 0x31C: + case 0x31D: + case 0x31E: + case 0x31F: + case 0x324: + case 0x325: + case 0x326: + case 0x327: + case 0x32C: + case 0x32D: + case 0x330: + case 0x331: + case 0x332: + case 0x333: + case 0x334: + if (VarGet(VAR_0x4054) != 0) + { + VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x4000); + } + break; + } +}