diff --git a/asm/secret_base.s b/asm/secret_base.s index 4d940cb82c..6ec19b4ce5 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,110 +5,6 @@ .text - thumb_func_start sub_80EB18C -sub_80EB18C: @ 80EB18C - push {r4,r5,lr} - movs r5, 0 - adds r4, r0, 0 -_080EB192: - ldrb r0, [r4, 0xD] - cmp r0, 0x1 - bne _080EB19E - adds r0, r4, 0 - bl ClearSecretBase -_080EB19E: - adds r4, 0xA0 - adds r5, 0x1 - cmp r5, 0x13 - bls _080EB192 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80EB18C - - thumb_func_start sub_80EB1AC -sub_80EB1AC: @ 80EB1AC - push {lr} - ldr r0, =0x000040ec - movs r1, 0 - bl VarSet - ldr r0, =0x000040ed - movs r1, 0 - bl VarSet - ldr r0, =0x000040ee - movs r1, 0 - bl VarSet - ldr r0, =0x000040ef - movs r1, 0 - bl VarSet - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080EB1FC - ldr r0, =0x000040f0 - movs r1, 0x1 - bl VarSet - b _080EB204 - .pool -_080EB1FC: - ldr r0, =0x000040f0 - movs r1, 0 - bl VarSet -_080EB204: - ldr r1, =gUnknown_0203A01D - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EB1AC - - thumb_func_start sub_80EB218 -sub_80EB218: @ 80EB218 - push {r4-r6,lr} - ldr r5, =0x000040f0 - adds r0, r5, 0 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _080EB272 - ldr r6, =gUnknown_0203A01D - ldrb r0, [r6] - cmp r0, 0x1 - bne _080EB272 - bl CurrentMapIsSecretBase - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080EB272 - adds r0, r5, 0 - movs r1, 0 - bl VarSet - strb r4, [r6] - bl sub_80EEA70 - ldr r0, =0x000040ec - movs r1, 0 - bl VarSet - ldr r0, =0x000040ed - movs r1, 0 - bl VarSet - ldr r0, =0x000040ee - movs r1, 0 - bl VarSet - ldr r0, =0x000040ef - movs r1, 0 - bl VarSet - adds r0, r5, 0 - movs r1, 0 - bl VarSet -_080EB272: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EB218 - thumb_func_start sub_80EB290 sub_80EB290: @ 80EB290 push {r4,lr} diff --git a/include/tv.h b/include/tv.h index 172754ae05..43f36d69f1 100644 --- a/include/tv.h +++ b/include/tv.h @@ -10,6 +10,7 @@ bool8 GetPriceReduction(u8 newsKind); u8 GetRibbonCount(struct Pokemon *pokemon); void TV_PutSecretBaseVisitOnTheAir(void); void sub_80EE184(void); +void sub_80EEA70(void); void sub_80F14F8(TVShow *shows); size_t sub_80EF370(int value); diff --git a/include/vars.h b/include/vars.h index 32d3e3786b..c097faff70 100644 --- a/include/vars.h +++ b/include/vars.h @@ -67,6 +67,7 @@ #define VAR_0x40ED 0x40ED #define VAR_0x40EE 0x40EE #define VAR_0x40EF 0x40EF +#define VAR_0x40F0 0x40F0 #define VAR_DAILY_BP 0x40F1 #endif // GUARD_VARS_H diff --git a/src/secret_base.c b/src/secret_base.c index d6c4786f17..081848513d 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -36,6 +36,7 @@ #include "decoration.h" #include "decoration_inventory.h" #include "link.h" +#include "tv.h" #include "secret_base.h" // Static type declarations @@ -1890,3 +1891,48 @@ void sub_80EAF80(void *records, size_t recordSize, u8 linkIdx) } } } + +void sub_80EB18C(struct SecretBaseRecord *bases) +{ + u32 i; + + for (i = 0; i < 20; i ++) + { + if (bases[i].language == LANGUAGE_JAPANESE) + { + ClearSecretBase(&bases[i]); + } + } +} + +void sub_80EB1AC(void) +{ + VarSet(VAR_0x40EC, 0); + VarSet(VAR_0x40ED, 0); + VarSet(VAR_0x40EE, 0); + VarSet(VAR_0x40EF, 0); + if (VarGet(VAR_0x4054) != 0) + { + VarSet(VAR_0x40F0, TRUE); + } + else + { + VarSet(VAR_0x40F0, FALSE); + } + gUnknown_0203A01D = FALSE; +} + +void sub_80EB218(void) +{ + if (VarGet(VAR_0x40F0) && gUnknown_0203A01D == TRUE && !CurrentMapIsSecretBase()) + { + VarSet(VAR_0x40F0, FALSE); + gUnknown_0203A01D = FALSE; + sub_80EEA70(); + VarSet(VAR_0x40EC, 0); + VarSet(VAR_0x40ED, 0); + VarSet(VAR_0x40EE, 0); + VarSet(VAR_0x40EF, 0); + VarSet(VAR_0x40F0, FALSE); + } +}