summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2018-12-30 12:32:42 -0500
committerscnorton <scnorton@biociphers.org>2018-12-30 12:32:42 -0500
commit0216888949983ec9fcc4649624723714a80db86f (patch)
tree783e6bc790ee57461184a5558ba9113930c6561a /src
parent220fe47299e9fd43ffd2cacfb0222ea4f5548998 (diff)
through sub_815D8F8
Diffstat (limited to 'src')
-rw-r--r--src/trainer_tower.c53
1 files changed, 43 insertions, 10 deletions
diff --git a/src/trainer_tower.c b/src/trainer_tower.c
index f2726d59b..86b4639dd 100644
--- a/src/trainer_tower.c
+++ b/src/trainer_tower.c
@@ -1,19 +1,24 @@
#include "global.h"
+#include "constants/flags.h"
+#include "constants/vars.h"
#include "malloc.h"
#include "save.h"
#include "event_data.h"
#include "cereader_tool.h"
-struct UnkStruct_8479D38
+struct UnkStruct_8479D34
{
+ s8 mapGroup;
+ s8 mapNum;
+ u8 filler[2];
u8 flags1[8];
u8 flags2[8];
u8 flags3[8];
- u8 unk_24;
- u8 unk_25;
};
-extern const struct UnkStruct_8479D38 gUnknown_8479D38[15];
+extern const struct UnkStruct_8479D34 gUnknown_8479D34[15];
+
+void sub_815D96C(void);
bool32 sub_815D7BC(void * dest, void * buffer)
{
@@ -50,17 +55,45 @@ void sub_815D838(void)
for (i = 0; i < 15; i++)
{
- const u8 * flags1 = gUnknown_8479D38[i].flags1;
- const u8 * flags2 = gUnknown_8479D38[i].flags2;
- const u8 * flags3 = gUnknown_8479D38[i].flags3;
+ const u8 * flags1 = gUnknown_8479D34[i].flags1;
+ const u8 * flags2 = gUnknown_8479D34[i].flags2;
+ const u8 * flags3 = gUnknown_8479D34[i].flags3;
for (j = 0; j < 8; j++)
{
if (flags1[j] != 0xFF)
- FlagSet(1000 + flags1[j]);
+ FlagSet(FLAG_TRAINER_TOWER_START + flags1[j]);
if (flags2[j] != 0xFF)
- FlagSet(1000 + flags2[j]);
+ FlagSet(FLAG_TRAINER_TOWER_START + flags2[j]);
if (flags3[j] != 0xFF)
- FlagSet(1000 + flags3[j]);
+ FlagSet(FLAG_TRAINER_TOWER_START + flags3[j]);
}
}
}
+
+void sub_815D8C8(void)
+{
+ u16 var = VarGet(VAR_0x4023);
+ if (var < 1500) {
+ VarSet(VAR_0x4023, var + 1);
+ }
+}
+
+void sub_815D8F8(void)
+{
+ u8 i;
+ register u32 found_map asm("r4") = 0xFF;
+ for (i = 0; i < 15; i++)
+ {
+ if (gUnknown_8479D34[i].mapGroup == gSaveBlock1Ptr->location.mapGroup && gUnknown_8479D34[i].mapNum == gSaveBlock1Ptr->location.mapNum)
+ found_map = i;
+ }
+
+ if (found_map == 0xFF)
+ return;
+ if (VarGet(VAR_0x4023) >= 1500)
+ {
+ VarSet(VAR_0x4023, 0);
+ sub_815D838();
+ sub_815D96C();
+ }
+}