From 4b459cd4607a48a84bcc14122d2ad324424fdff2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jan 2019 17:08:30 -0500 Subject: through sub_815E1F0 --- src/trainer_tower.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 91132c07b..eb9637b71 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -1,5 +1,6 @@ #include "global.h" #include "main.h" +#include "task.h" #include "constants/flags.h" #include "constants/vars.h" #include "malloc.h" @@ -11,6 +12,10 @@ #include "cereader_tool.h" #include "easy_chat.h" #include "text.h" +#include "battle_setup.h" +#include "battle_transition.h" +#include "battle.h" +#include "battle_2.h" #include "overworld.h" struct UnkStruct_8479D34 @@ -28,7 +33,6 @@ struct UnkSubstruct_203F458_000C_004 /* 0x000 */ u8 unk_000[11]; /* 0x00B */ u8 unk_00B; /* 0x00C */ u8 unk_00C; - /* 0x00D */ u8 unk_00D; /* 0x00E */ u16 unk_00E[6]; /* 0x01A */ u16 unk_01A[6]; /* 0x026 */ u16 unk_026[6]; @@ -122,6 +126,7 @@ void sub_815E8CC(void); void sub_815E908(void); void sub_815E948(void); void sub_815E9C8(void); +void sub_815E9FC(void); void sub_815EC0C(void); extern const struct UnkStruct_8479D34 gUnknown_8479D34[15]; @@ -280,7 +285,7 @@ void sub_815DA54(void) gUnknown_203F45C->unk_3C = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; gUnknown_203F45C->unk_3D = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_00B; gUnknown_203F45C->unk_3E = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_00C; - SetVBlankCounter1Ptr(gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx]); + SetVBlankCounter1Ptr(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); sub_815DD2C(); } @@ -692,3 +697,77 @@ void sub_815DF54(void) "_0815E064: .4byte gStringVar4"); } #endif // NONMATCHING + +void sub_815E068(u8 battleType, u8 facilityClass) +{ + u16 r5 = FALSE; + s32 r4; + switch (battleType) + { + case 0: + case 2: + for (r4 = 0; r4 < NELEMS(gUnknown_8479ED8); r4++) + { + if (gUnknown_8479ED8[r4].unk1 == facilityClass) + break; + } + if (r4 != NELEMS(gUnknown_8479ED8)) + r5 = gUnknown_8479ED8[r4].unk2; + break; + case 1: + for (r4 = 0; r4 < NELEMS(gUnknown_847A024); r4++) + { + if (gUnknown_847A024[r4].unk2 == facilityClass) + break; + } + if (r4 != NELEMS(gUnknown_847A024)) + { + if (VarGet(VAR_0x4003)) + r5 = gUnknown_847A024[r4].unk4; + else + r5 = gUnknown_847A024[r4].unk3; + } + break; + } + gUnknown_20370DC = gUnknown_20370DA; + gUnknown_20370DA = r5; +} + +void sub_815E114(void) +{ + SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music); +} + +void sub_815E124(u8 taskId) +{ + if (sub_80D08F8() == TRUE) + { + gMain.savedCallback = sub_815E114; + sub_80563F0(); + SetMainCallback2(sub_800FD9C); + DestroyTask(taskId); + } +} + +void sub_815E160(void) +{ + gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY; + if (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002 == 1) + gBattleTypeFlags |= BATTLE_TYPE_DOUBLE; + gTrainerBattleOpponent_A = 0; + sub_815E9FC(); + CreateTask(sub_815E124, 1); + PlayMapChosenOrBattleBGM(0); + sub_80D08B8(sub_8080060()); +} + +void sub_815E1C0(void) +{ + if (!gSpecialVar_0x8005) + gSpecialVar_Result = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; +} + +void sub_815E1F0(void) +{ + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8++; +} -- cgit v1.2.3 From 1e699465bdef048f0c2d9574db6ca9a0dd77b051 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jan 2019 18:12:00 -0500 Subject: through sub_815E5C4 --- src/trainer_tower.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 3 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index eb9637b71..b196c49f7 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -17,6 +17,7 @@ #include "battle.h" #include "battle_2.h" #include "overworld.h" +#include "item.h" struct UnkStruct_8479D34 { @@ -42,7 +43,8 @@ struct UnkSubstruct_203F458_000C_004 struct UnkSubstruct_203F458_000C { - /* 0x000 */ u8 filler_000[2]; + /* 0x000 */ u8 unk_000; + /* 0x000 */ u8 unk_001; /* 0x002 */ u8 unk_002; /* 0x003 */ u8 unk_003; /* 0x004 */ struct UnkSubstruct_203F458_000C_004 unk_004[3]; @@ -128,14 +130,17 @@ void sub_815E948(void); void sub_815E9C8(void); void sub_815E9FC(void); void sub_815EC0C(void); +u32 sub_815EDDC(u32 *); +void sub_815EDF4(u32 *, u32); extern const struct UnkStruct_8479D34 gUnknown_8479D34[15]; +extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83]; +extern const struct UnkStruct_847A024 gUnknown_847A024[10]; extern void (*const gUnknown_847A230[])(void); extern const struct Unk_203F458_Header gUnknown_84827AC; extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; extern const u16 gUnknown_847A284[8][3]; -extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83]; -extern const struct UnkStruct_847A024 gUnknown_847A024[10]; +extern const u16 gUnknown_847A2B4[]; bool32 sub_815D7BC(void * dest, void * buffer) { @@ -771,3 +776,85 @@ void sub_815E1F0(void) { gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8++; } + +void sub_815E218(void) +{ + u16 mapDataId = gMapHeader.mapDataId; + if (mapDataId - 0x12A == gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8 && mapDataId - 0x129 <= gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_001) + gSpecialVar_Result = FALSE; + else + gSpecialVar_Result = TRUE; +} + +void sub_815E28C(void) +{ + gSaveBlock1Ptr->unkArrayIdx = gSpecialVar_0x8005; + if (gSaveBlock1Ptr->unkArrayIdx >= NELEMS(gSaveBlock1Ptr->unkArray)) + gSaveBlock1Ptr->unkArrayIdx = 0; + sub_815EC0C(); + if (!sub_815D834()) + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_5 = TRUE; + else + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_5 = FALSE; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8 = 0; + SetVBlankCounter1Ptr(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 = 0; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2 = FALSE; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_1 = FALSE; +} + +void sub_815E394(void) +{ + DisableVBlankCounter1(); + gSpecialVar_Result = 0; + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2) + gSpecialVar_Result++; + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 && gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_1) + gSpecialVar_Result++; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2 = TRUE; +} + +void sub_815E408(void) +{ + u16 itemId = gUnknown_847A2B4[gUnknown_203F458->unk_0004.unk_0008->unk_003]; + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0) + gSpecialVar_Result = 2; + else if (sub_809A084(itemId, 1) == 1) + { + sub_8099E90(itemId, gStringVar2); + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 = TRUE; + gSpecialVar_Result = 0; + } + else + gSpecialVar_Result = 1; +} + +void sub_815E4B0(void) +{ + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_1) + gSpecialVar_Result = 2; + else if (sub_815EDDC(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4) > gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0) + { + sub_815EDF4(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4, gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); + gSpecialVar_Result = 0; + } + else + gSpecialVar_Result = 1; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_1 = TRUE; +} + +void sub_815E56C(void) +{ + if (!gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2) + { + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 >= 215999) + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 = 215999; + else + SetVBlankCounter1Ptr(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); + } +} + +void sub_815E5C4(void) +{ + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3 = 1; +} -- cgit v1.2.3 From b16831e97bb8b94c29854a81e11647e8a5db68c6 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 11:57:00 -0500 Subject: through ScrCmd_fadeinbgm --- src/trainer_tower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 91132c07b..74065445a 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -430,12 +430,12 @@ void sub_815DD44(void) if (gMapHeader.mapDataId - 0x129 > gUnknown_203F458->unk_0004.unk_0000.unk0) { gSpecialVar_Result = 3; - sub_8055D40(0x132); + SetCurrentMapLayout(0x132); } else { gSpecialVar_Result = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; - sub_8055D40(gUnknown_847A284[gUnknown_203F458->unk_0000][gSpecialVar_Result]); + SetCurrentMapLayout(gUnknown_847A284[gUnknown_203F458->unk_0000][gSpecialVar_Result]); sub_815DDB0(); } } -- cgit v1.2.3 From 2822d29c0bd7e579388f9d0772a7b5d1af430b31 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 15:28:10 -0500 Subject: through ScrCmd_bufferstring --- src/trainer_tower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index c968f24c3..f4e18eee6 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -821,7 +821,7 @@ void sub_815E408(void) gSpecialVar_Result = 2; else if (AddBagItem(itemId, 1) == 1) { - sub_8099E90(itemId, gStringVar2); + CopyItemName(itemId, gStringVar2); gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 = TRUE; gSpecialVar_Result = 0; } -- cgit v1.2.3 From 9c5f01fc8efb546fa6ef546cd1c627befcfd6740 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 8 Jan 2019 08:45:19 -0500 Subject: through sub_815E948 --- src/trainer_tower.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index f4e18eee6..8ced159c5 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -18,6 +18,10 @@ #include "battle_2.h" #include "overworld.h" #include "item.h" +#include "window.h" +#include "menu.h" +#include "new_menu_helpers.h" +#include "sound.h" struct UnkStruct_8479D34 { @@ -98,6 +102,12 @@ struct UnkStruct_847A024 bool8 unk4; }; +struct UnkStruct_847A074 +{ + u8 unk0; + u8 unk1; +}; + EWRAM_DATA struct UnkStruct_203F458 * gUnknown_203F458 = NULL; EWRAM_DATA struct UnkStruct_203F45C * gUnknown_203F45C = NULL; @@ -133,14 +143,21 @@ void sub_815EC0C(void); u32 sub_815EDDC(u32 *); void sub_815EDF4(u32 *, u32); +extern const u8 gUnknown_83FE982[]; +extern const u8 gUnknown_83FE998[]; +extern const u8 *const gUnknown_83FE9C4[]; + extern const struct UnkStruct_8479D34 gUnknown_8479D34[15]; extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83]; extern const struct UnkStruct_847A024 gUnknown_847A024[10]; +extern const struct UnkStruct_847A074 gUnknown_847A074[105]; +extern const struct WindowTemplate gUnknown_847A218; extern void (*const gUnknown_847A230[])(void); extern const struct Unk_203F458_Header gUnknown_84827AC; extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; extern const u16 gUnknown_847A284[8][3]; extern const u16 gUnknown_847A2B4[]; +extern const u16 gUnknown_847A2D2[]; bool32 sub_815D7BC(void * dest, void * buffer) { @@ -858,3 +875,133 @@ void sub_815E5C4(void) { gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3 = 1; } + +void sub_815E5F0(void) +{ + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3) + { + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_3 = FALSE; + gSpecialVar_Result = 0; + } + else if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_4) + { + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_4 = FALSE; + gSpecialVar_Result = 1; + } + else + { + gSpecialVar_Result = 2; + } +} + +#define PRINT_TOWER_TIME(src) ({ \ + s32 minutes, seconds, centiseconds, frames; \ + \ + frames = (src); \ + \ + minutes = frames / 3600; \ + frames %= 3600; \ + seconds = frames / 60; \ + frames %= 60; \ + centiseconds = frames * 168 / 100; \ + \ + ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_RIGHT_ALIGN, 2); \ + ConvertIntToDecimalStringN(gStringVar2, seconds, STR_CONV_MODE_RIGHT_ALIGN, 2); \ + ConvertIntToDecimalStringN(gStringVar3, centiseconds, STR_CONV_MODE_LEADING_ZEROS, 2); \ +}) + +void sub_815E658(void) +{ + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 >= 215999) + { + DisableVBlankCounter1(); + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0 = 215999; + } + + PRINT_TOWER_TIME(gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); +} + +void sub_815E720(void) +{ + u8 windowId; + s32 i; + s32 minutes, seconds, centiseconds; + + sub_815EC0C(); + windowId = AddWindow(&gUnknown_847A218); + sub_80F6E9C(); + sub_80F6F1C(windowId, FALSE); + AddTextPrinterParameterized(windowId, 2, gUnknown_83FE982, 0x4A, 0, 0xFF, NULL); + + for (i = 0; i < 4; i++) + { + PRINT_TOWER_TIME(sub_815EDDC(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4)); + + StringExpandPlaceholders(gStringVar4, gUnknown_83FE998); + AddTextPrinterParameterized(windowId, 2, gUnknown_83FE9C4[i - 1], 0x18, 0x24 + 0x14 * i, 0xFF, NULL); + AddTextPrinterParameterized(windowId, 2, gStringVar4, 0x60, 0x2E + 0x14 * i, 0xFF, NULL); + } + + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 3); + VarSet(VAR_0x4001, windowId); +} + +void sub_815E88C(void) +{ + u8 windowId = VarGet(VAR_0x4001); + sub_810F4D8(windowId, TRUE); + RemoveWindow(windowId); +} + +void sub_815E8B4(void) +{ + gSpecialVar_Result = GetMonsStateToDoubles(); +} + +void sub_815E8CC(void) +{ + if (gUnknown_203F458->unk_0004.unk_0000.unk0 != gUnknown_203F458->unk_0004.unk_0008[0].unk_001) + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_203F458->unk_0004.unk_0000.unk0, STR_CONV_MODE_LEFT_ALIGN, 1); + gSpecialVar_Result = TRUE; + } + else + { + gSpecialVar_Result = FALSE; + } +} + +void sub_815E908(void) +{ + if (gMapHeader.mapDataId == 0x0129 && VarGet(VAR_0x4082) == 0) + { + gSpecialVar_Result = FALSE; + } + else + { + gSpecialVar_Result = FALSE; + } +} + +void sub_815E948(void) +{ + s32 i; + u16 var_4001 = VarGet(VAR_0x4001); + u8 r1 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[var_4001].unk_00B; + + for (i = 0; i < NELEMS(gUnknown_847A074); i++) + { + if (gUnknown_847A074[i].unk0 == gFacilityClassToTrainerClass[r1]) + break; + } + if (i != NELEMS(gUnknown_847A074)) + { + var_4001 = gUnknown_847A074[i].unk1; + } + else + { + var_4001 = 0; + } + PlayNewMapMusic(gUnknown_847A2D2[var_4001]); +} -- cgit v1.2.3 From 7738fcee638985656b7cf376ec6936f04f53c255 Mon Sep 17 00:00:00 2001 From: scnorton Date: Tue, 8 Jan 2019 10:20:51 -0500 Subject: through sub_815E9FC --- src/trainer_tower.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 8ced159c5..889d90696 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -139,6 +139,7 @@ void sub_815E908(void); void sub_815E948(void); void sub_815E9C8(void); void sub_815E9FC(void); +s32 sub_815EBB8(void); void sub_815EC0C(void); u32 sub_815EDDC(u32 *); void sub_815EDF4(u32 *, u32); @@ -158,6 +159,9 @@ extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; extern const u16 gUnknown_847A284[8][3]; extern const u16 gUnknown_847A2B4[]; extern const u16 gUnknown_847A2D2[]; +extern const u8 gUnknown_847A2EE[][2]; +extern const u8 gUnknown_847A2FE[][2]; +extern const u8 gUnknown_847A30E[][3]; bool32 sub_815D7BC(void * dest, void * buffer) { @@ -1005,3 +1009,51 @@ void sub_815E948(void) } PlayNewMapMusic(gUnknown_847A2D2[var_4001]); } + +void sub_815E9C8(void) +{ + gSpecialVar_Result = gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2; +} + +void sub_815E9FC(void) +{ + u16 r4 = VarGet(VAR_0x4001); + s32 r9 = sub_815EBB8(); + u8 r5 = gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8; + s32 r6; + u8 r2; + + ZeroEnemyPartyMons(); + + switch (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002) + { + case 0: + default: + for (r6 = 0; r6 < 2; r6++) + /* + * sp+0 := r5 * 2 + * r5 := gUnknown_203F458 + * r7 := r4 * 72 + * r8 := r7 + 4 + */ + { + r2 = gUnknown_847A2EE[r5][r6]; + gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[r6], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); + } + break; + case 1: + r2 = gUnknown_847A2FE[r5][0]; + gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2]); + r2 = gUnknown_847A2FE[r5][1]; + gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[1], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2]); + break; + case 2: + r2 = gUnknown_847A30E[r5][r4]; + gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); + break; + } +} -- cgit v1.2.3 From ca1c274c1611783c5db53669fb7a456adb73bb4b Mon Sep 17 00:00:00 2001 From: scnorton Date: Tue, 8 Jan 2019 10:44:34 -0500 Subject: trainer tower: finish code decomp --- src/trainer_tower.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 8 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 889d90696..067bdc4ae 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -3,6 +3,7 @@ #include "task.h" #include "constants/flags.h" #include "constants/vars.h" +#include "constants/species.h" #include "malloc.h" #include "save.h" #include "util.h" @@ -139,7 +140,7 @@ void sub_815E908(void); void sub_815E948(void); void sub_815E9C8(void); void sub_815E9FC(void); -s32 sub_815EBB8(void); +static s32 GetPartyMaxLevel(void); void sub_815EC0C(void); u32 sub_815EDDC(u32 *); void sub_815EDF4(u32 *, u32); @@ -153,6 +154,7 @@ extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83]; extern const struct UnkStruct_847A024 gUnknown_847A024[10]; extern const struct UnkStruct_847A074 gUnknown_847A074[105]; extern const struct WindowTemplate gUnknown_847A218; +extern const struct TextColor gUnknown_847A22C; extern void (*const gUnknown_847A230[])(void); extern const struct Unk_203F458_Header gUnknown_84827AC; extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; @@ -1018,7 +1020,7 @@ void sub_815E9C8(void) void sub_815E9FC(void) { u16 r4 = VarGet(VAR_0x4001); - s32 r9 = sub_815EBB8(); + s32 r9 = GetPartyMaxLevel(); u8 r5 = gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8; s32 r6; u8 r2; @@ -1030,12 +1032,6 @@ void sub_815E9FC(void) case 0: default: for (r6 = 0; r6 < 2; r6++) - /* - * sp+0 := r5 * 2 - * r5 := gUnknown_203F458 - * r7 := r4 * 72 - * r8 := r7 + 4 - */ { r2 = gUnknown_847A2EE[r5][r6]; gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; @@ -1057,3 +1053,74 @@ void sub_815E9FC(void) break; } } + +static s32 GetPartyMaxLevel(void) +{ + s32 topLevel = 0; + s32 i; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != 0 && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG) + { + s32 currLevel = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL, NULL); + if (currLevel > topLevel) + topLevel = currLevel; + } + } + + return topLevel; +} + +void sub_815EC0C(void) +{ + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 != gUnknown_203F458->unk_0004.unk_0000.unk1) + { + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 = gUnknown_203F458->unk_0004.unk_0000.unk1; + sub_815EDF4(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4, 215999); + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 = FALSE; + } +} + +void sub_815EC8C(void) +{ + s32 i; + u8 windowId = 0; + + sub_815DC8C(); + FillWindowPixelRect(0, 0, 0, 0, 0xd8, 0x90); + sub_815EC0C(); + box_print(0, 2, 0x4a, 0, &gUnknown_847A22C, 0, gUnknown_83FE982); + + for (i = 0; i < 4; i++) + { + PRINT_TOWER_TIME(sub_815EDDC(&gSaveBlock1Ptr->unkArray[i].unk4)); + StringExpandPlaceholders(gStringVar4, gUnknown_83FE998); + box_print(windowId, 2, 0x18, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gUnknown_83FE9C4[i]); + box_print(windowId, 2, 0x60, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gStringVar4); + } + + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 3); + sub_815DD2C(); +} + +u32 sub_815EDDC(u32 * counter) +{ + return *counter ^ gSaveBlock2Ptr->encryptionKey; +} + +void sub_815EDF4(u32 * counter, u32 value) +{ + *counter = value ^ gSaveBlock2Ptr->encryptionKey; +} + +void sub_815EE0C(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + sub_815EDF4(&gSaveBlock1Ptr->unkArray[i].unk4, 215999); + } +} -- cgit v1.2.3 From b9979f71e7d21f3ebab282dfd9351517c98a5bbe Mon Sep 17 00:00:00 2001 From: scnorton Date: Tue, 8 Jan 2019 10:59:54 -0500 Subject: Trainer tower data decomp --- src/trainer_tower.c | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 414 insertions(+), 14 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 067bdc4ae..ef34c1629 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -3,6 +3,7 @@ #include "task.h" #include "constants/flags.h" #include "constants/vars.h" +#include "constants/items.h" #include "constants/species.h" #include "malloc.h" #include "save.h" @@ -149,21 +150,420 @@ extern const u8 gUnknown_83FE982[]; extern const u8 gUnknown_83FE998[]; extern const u8 *const gUnknown_83FE9C4[]; -extern const struct UnkStruct_8479D34 gUnknown_8479D34[15]; -extern const struct UnkStruct_8479ED8 gUnknown_8479ED8[83]; -extern const struct UnkStruct_847A024 gUnknown_847A024[10]; -extern const struct UnkStruct_847A074 gUnknown_847A074[105]; -extern const struct WindowTemplate gUnknown_847A218; -extern const struct TextColor gUnknown_847A22C; -extern void (*const gUnknown_847A230[])(void); +const struct UnkStruct_8479D34 gUnknown_8479D34[] = { + { + 0x03, 0x26, + .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x27, + .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0x9a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x01, 0x1f, + .flags1 = {0x4c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x01, 0x22, + .flags1 = {0x53, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x41, + .flags1 = {0x40, 0x41, 0x42, 0x43, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x01, 0x02, + .flags1 = {0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0xff, 0xff}, + .flags2 = {0x54, 0x55, 0x56, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x01, 0x6d, + .flags1 = {0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0x66}, + .flags2 = {0x5b, 0x5d, 0x5e, 0x5f, 0x63, 0x64, 0x65, 0xff}, + .flags3 = {0x5a, 0x5c, 0x60, 0x61, 0x62, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x2e, + .flags1 = {0x6b, 0x6c, 0x6d, 0x6e, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xff, 0xff}, + .flags3 = {0x6b, 0x6c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x30, + .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xa6, 0xa7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x0f, + .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xa8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xa9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x39, + .flags1 = {0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x36, + .flags1 = {0xae, 0xb0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xaf, 0xb1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x3a, + .flags1 = {0xb2, 0xb3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x3b, + .flags1 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xb4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + { + 0x03, 0x3e, + .flags1 = {0xb9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags2 = {0xba, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .flags3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, +}; + +const struct UnkStruct_8479ED8 gUnknown_8479ED8[] = { + {0x1c, 0x03, 0x01}, + {0x38, 0x04, 0x00}, + {0x25, 0x06, 0x01}, + {0x26, 0x07, 0x00}, + {0x29, 0x08, 0x00}, + {0x2a, 0x09, 0x01}, + {0x34, 0x0a, 0x00}, + {0x1c, 0x0b, 0x01}, + {0x1d, 0x0c, 0x01}, + {0x13, 0x0d, 0x00}, + {0x34, 0x0e, 0x00}, + {0x2d, 0x0f, 0x00}, + {0x36, 0x10, 0x00}, + {0x1a, 0x11, 0x00}, + {0x1a, 0x12, 0x00}, + {0x27, 0x13, 0x00}, + {0x34, 0x14, 0x00}, + {0x13, 0x15, 0x00}, + {0x17, 0x16, 0x01}, + {0x3d, 0x17, 0x00}, + {0x13, 0x1d, 0x00}, + {0x17, 0x1e, 0x01}, + {0x1e, 0x20, 0x00}, + {0x1f, 0x21, 0x01}, + {0x20, 0x22, 0x00}, + {0x23, 0x23, 0x01}, + {0x12, 0x24, 0x00}, + {0x39, 0x26, 0x00}, + {0x29, 0x2d, 0x00}, + {0x1a, 0x2e, 0x00}, + {0x10, 0x2f, 0x00}, + {0x18, 0x30, 0x01}, + {0x1d, 0x31, 0x01}, + {0x2e, 0x32, 0x01}, + {0x28, 0x33, 0x01}, + {0x3e, 0x35, 0x00}, + {0x1b, 0x38, 0x00}, + {0x19, 0x40, 0x00}, + {0x1c, 0x41, 0x01}, + {0x27, 0x42, 0x00}, + {0x28, 0x43, 0x01}, + {0x16, 0x47, 0x01}, + {0x14, 0x48, 0x00}, + {0x38, 0x49, 0x00}, + {0x12, 0x58, 0x00}, + {0x14, 0x59, 0x00}, + {0x16, 0x5a, 0x01}, + {0x3e, 0x5b, 0x00}, + {0x27, 0x5c, 0x00}, + {0x28, 0x5d, 0x01}, + {0x34, 0x5e, 0x00}, + {0x34, 0x5f, 0x00}, + {0x38, 0x60, 0x00}, + {0x35, 0x61, 0x00}, + {0x34, 0x62, 0x00}, + {0x1e, 0x63, 0x00}, + {0x39, 0x64, 0x00}, + {0x2d, 0x65, 0x00}, + {0x35, 0x66, 0x00}, + {0x20, 0x67, 0x00}, + {0x1d, 0x68, 0x01}, + {0x2e, 0x69, 0x01}, + {0x13, 0x6a, 0x00}, + {0x1a, 0x6b, 0x00}, + {0x1a, 0x6c, 0x00}, + {0x19, 0x6d, 0x00}, + {0x1a, 0x6e, 0x00}, + {0x36, 0x6f, 0x00}, + {0x37, 0x71, 0x00}, + {0x29, 0x74, 0x00}, + {0x2a, 0x75, 0x01}, + {0x3d, 0x7a, 0x00}, + {0x3a, 0x7d, 0x01}, + {0x17, 0x89, 0x01}, + {0x18, 0x8a, 0x01}, + {0x25, 0x8b, 0x01}, + {0x1c, 0x8c, 0x01}, + {0x27, 0x8d, 0x00}, + {0x28, 0x8e, 0x01}, + {0x1c, 0x8f, 0x01}, + {0x38, 0x90, 0x00}, + {0x1c, 0x91, 0x01}, + {0x16, 0x92, 0x01} +}; + +const struct UnkStruct_847A024 gUnknown_847A024[] = { + {0x1d, 0x17, 0x1f, 0x01, 0x01}, + {0x11, 0x11, 0x34, 0x01, 0x01}, + {0x1d, 0x19, 0x4a, 0x01, 0x00}, + {0x20, 0x23, 0x4b, 0x00, 0x01}, + {0x26, 0x2e, 0x4c, 0x00, 0x01}, + {0x11, 0x11, 0x7e, 0x01, 0x01}, + {0x29, 0x2a, 0x7f, 0x00, 0x01}, + {0x1d, 0x19, 0x80, 0x01, 0x00}, + {0x18, 0x36, 0x81, 0x01, 0x00}, + {0x2e, 0x26, 0x82, 0x01, 0x00} +}; + +const struct UnkStruct_847A074 gUnknown_847A074[105] = { + {0x03, 0x06}, + {0x37, 0x06}, + {0x02, 0x06}, + {0x67, 0x01}, + {0x04, 0x01}, + {0x24, 0x04}, + {0x4a, 0x01}, + {0x26, 0x01}, + {0x2a, 0x00}, + {0x42, 0x03}, + {0x1b, 0x09}, + {0x4c, 0x03}, + {0x44, 0x03}, + {0x21, 0x04}, + {0x43, 0x03}, + {0x6a, 0x01}, + {0x5d, 0x05}, + {0x56, 0x05}, + {0x09, 0x05}, + {0x11, 0x04}, + {0x48, 0x03}, + {0x3c, 0x00}, + {0x29, 0x00}, + {0x5c, 0x09}, + {0x28, 0x09}, + {0x06, 0x0c}, + {0x68, 0x0b}, + {0x05, 0x0b}, + {0x58, 0x0d}, + {0x16, 0x0d}, + {0x46, 0x08}, + {0x0f, 0x01}, + {0x3f, 0x03}, + {0x0e, 0x03}, + {0x5f, 0x04}, + {0x63, 0x04}, + {0x50, 0x04}, + {0x10, 0x04}, + {0x52, 0x03}, + {0x35, 0x04}, + {0x5b, 0x03}, + {0x14, 0x03}, + {0x3d, 0x00}, + {0x13, 0x00}, + {0x12, 0x0b}, + {0x30, 0x07}, + {0x38, 0x07}, + {0x2f, 0x07}, + {0x3b, 0x01}, + {0x31, 0x01}, + {0x4e, 0x0b}, + {0x3a, 0x00}, + {0x32, 0x00}, + {0x23, 0x03}, + {0x0d, 0x0d}, + {0x0a, 0x03}, + {0x49, 0x01}, + {0x0c, 0x01}, + {0x69, 0x01}, + {0x0b, 0x01}, + {0x25, 0x01}, + {0x3e, 0x02}, + {0x27, 0x02}, + {0x65, 0x01}, + {0x2d, 0x01}, + {0x61, 0x01}, + {0x2b, 0x03}, + {0x66, 0x05}, + {0x2e, 0x05}, + {0x2c, 0x00}, + {0x5e, 0x02}, + {0x34, 0x02}, + {0x51, 0x00}, + {0x59, 0x00}, + {0x40, 0x03}, + {0x55, 0x06}, + {0x53, 0x06}, + {0x4b, 0x04}, + {0x15, 0x04}, + {0x1a, 0x09}, + {0x57, 0x0a}, + {0x17, 0x01}, + {0x47, 0x03}, + {0x62, 0x01}, + {0x39, 0x00}, + {0x1d, 0x00}, + {0x1c, 0x04}, + {0x20, 0x00}, + {0x4f, 0x05}, + {0x22, 0x05}, + {0x45, 0x0b}, + {0x1f, 0x0b}, + {0x5a, 0x00}, + {0x1e, 0x00}, + {0x08, 0x00}, + {0x64, 0x02}, + {0x07, 0x02}, + {0x60, 0x08}, + {0x36, 0x08}, + {0x41, 0x0b}, + {0x33, 0x0b}, + {0x54, 0x00}, + {0x18, 0x01}, + {0x4d, 0x0b}, + {0x19, 0x00} +}; + +const struct WindowTemplate gUnknown_847A218[] = { + {0, 3, 1, 27, 18, 15, 0x001}, + DUMMY_WIN_TEMPLATE +}; + +const u32 gUnknown_847A228 = 0x70; // unused + +const struct TextColor gUnknown_847A22C = {0, 2, 3}; + +void (*const gUnknown_847A230[])(void) = { + sub_815DD44, + sub_815DF54, + sub_815E160, + sub_815E1C0, + sub_815E1F0, + sub_815E218, + sub_815E28C, + sub_815E394, + sub_815E408, + sub_815E4B0, + sub_815E56C, + sub_815E5C4, + sub_815E5F0, + sub_815E658, + sub_815E720, + sub_815E88C, + sub_815E8B4, + sub_815E8CC, + sub_815E908, + sub_815E948, + sub_815E9C8 +}; + +const u16 gUnknown_847A284[8][3] = { + {0x012a, 0x016e, 0x0176}, + {0x012b, 0x016f, 0x0177}, + {0x012c, 0x0170, 0x0178}, + {0x012d, 0x0171, 0x0179}, + {0x012e, 0x0172, 0x017a}, + {0x012f, 0x0173, 0x017b}, + {0x0130, 0x0174, 0x017c}, + {0x0131, 0x0175, 0x017d} +}; + +const u16 gUnknown_847A2B4[] = { + ITEM_HP_UP, + ITEM_PROTEIN, + ITEM_IRON, + ITEM_CARBOS, + ITEM_CALCIUM, + ITEM_ZINC, + ITEM_BRIGHT_POWDER, + ITEM_WHITE_HERB, + ITEM_MENTAL_HERB, + ITEM_CHOICE_BAND, + ITEM_KINGS_ROCK, + ITEM_SCOPE_LENS, + ITEM_METAL_COAT, + ITEM_DRAGON_SCALE, + ITEM_UP_GRADE +}; + +const u16 gUnknown_847A2D2[] = { + 0x011d, + 0x011c, + 0x011c, + 0x011b, + 0x011d, + 0x011d, + 0x011b, + 0x011b, + 0x011d, + 0x011c, + 0x011d, + 0x011d, + 0x011d, + 0x011d +}; + +const u8 gUnknown_847A2EE[][2] = { + {0x00, 0x02}, + {0x01, 0x03}, + {0x02, 0x04}, + {0x03, 0x05}, + {0x04, 0x01}, + {0x05, 0x02}, + {0x00, 0x03}, + {0x01, 0x04} +}; + +const u8 gUnknown_847A2FE[][2] = { + {0x00, 0x01}, + {0x01, 0x03}, + {0x02, 0x00}, + {0x03, 0x04}, + {0x04, 0x02}, + {0x05, 0x02}, + {0x00, 0x03}, + {0x01, 0x05} +}; + +const u8 gUnknown_847A30E[][3] = { + {0x00, 0x02, 0x04}, + {0x01, 0x03, 0x05}, + {0x02, 0x03, 0x01}, + {0x03, 0x04, 0x00}, + {0x04, 0x01, 0x02}, + {0x05, 0x00, 0x03}, + {0x00, 0x05, 0x02}, + {0x01, 0x04, 0x05} +}; + extern const struct Unk_203F458_Header gUnknown_84827AC; extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; -extern const u16 gUnknown_847A284[8][3]; -extern const u16 gUnknown_847A2B4[]; -extern const u16 gUnknown_847A2D2[]; -extern const u8 gUnknown_847A2EE[][2]; -extern const u8 gUnknown_847A2FE[][2]; -extern const u8 gUnknown_847A30E[][3]; bool32 sub_815D7BC(void * dest, void * buffer) { @@ -934,7 +1334,7 @@ void sub_815E720(void) s32 minutes, seconds, centiseconds; sub_815EC0C(); - windowId = AddWindow(&gUnknown_847A218); + windowId = AddWindow(gUnknown_847A218); sub_80F6E9C(); sub_80F6F1C(windowId, FALSE); AddTextPrinterParameterized(windowId, 2, gUnknown_83FE982, 0x4A, 0, 0xFF, NULL); -- cgit v1.2.3 From 915694e8a7a5967d76bcbe544d671bb2f962f608 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 11 Apr 2019 18:26:02 -0400 Subject: Documentation of oak_speech --- src/trainer_tower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index ef34c1629..e914d7ac6 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -1336,7 +1336,7 @@ void sub_815E720(void) sub_815EC0C(); windowId = AddWindow(gUnknown_847A218); sub_80F6E9C(); - sub_80F6F1C(windowId, FALSE); + DrawStdWindowFrame(windowId, FALSE); AddTextPrinterParameterized(windowId, 2, gUnknown_83FE982, 0x4A, 0, 0xFF, NULL); for (i = 0; i < 4; i++) -- cgit v1.2.3 From e9e87a0fe47406b5d2881b9360886842b8731c97 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 6 May 2019 10:49:10 -0400 Subject: egg_hatch as part of daycare --- src/trainer_tower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index e914d7ac6..d2f7c92a9 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -1171,7 +1171,7 @@ void sub_815E124(u8 taskId) if (sub_80D08F8() == TRUE) { gMain.savedCallback = sub_815E114; - sub_80563F0(); + CleanupOverworldWindowsAndTilemaps(); SetMainCallback2(sub_800FD9C); DestroyTask(taskId); } -- cgit v1.2.3 From b249154009efceb5710848a2567fb821d3e7217a Mon Sep 17 00:00:00 2001 From: garak Date: Thu, 30 May 2019 17:44:48 -0400 Subject: synchronize text printer function names with pokeemerald --- src/trainer_tower.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index d2f7c92a9..a36e93260 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -1490,14 +1490,14 @@ void sub_815EC8C(void) sub_815DC8C(); FillWindowPixelRect(0, 0, 0, 0, 0xd8, 0x90); sub_815EC0C(); - box_print(0, 2, 0x4a, 0, &gUnknown_847A22C, 0, gUnknown_83FE982); + AddTextPrinterParameterized3(0, 2, 0x4a, 0, &gUnknown_847A22C, 0, gUnknown_83FE982); for (i = 0; i < 4; i++) { PRINT_TOWER_TIME(sub_815EDDC(&gSaveBlock1Ptr->unkArray[i].unk4)); StringExpandPlaceholders(gStringVar4, gUnknown_83FE998); - box_print(windowId, 2, 0x18, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gUnknown_83FE9C4[i]); - box_print(windowId, 2, 0x60, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gStringVar4); + AddTextPrinterParameterized3(windowId, 2, 0x18, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gUnknown_83FE9C4[i]); + AddTextPrinterParameterized3(windowId, 2, 0x60, 0x24 + 0x14 * i, &gUnknown_847A22C, 0, gStringVar4); } PutWindowTilemap(windowId); -- cgit v1.2.3 From e07368e90b1c0804dc4e4f2269ce9dc5fb632999 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 14 Jun 2019 18:23:27 -0400 Subject: cereader_tool and ereader_helpers --- src/trainer_tower.c | 154 ++++++++++++++++------------------------------------ 1 file changed, 48 insertions(+), 106 deletions(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index a36e93260..46c112030 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -35,45 +35,10 @@ struct UnkStruct_8479D34 u8 flags3[8]; }; -struct UnkSubstruct_203F458_000C_004 -{ - /* 0x000 */ u8 unk_000[11]; - /* 0x00B */ u8 unk_00B; - /* 0x00C */ u8 unk_00C; - /* 0x00E */ u16 unk_00E[6]; - /* 0x01A */ u16 unk_01A[6]; - /* 0x026 */ u16 unk_026[6]; - /* 0x032 */ u16 unk_032[6]; - /* 0x040 */ struct BattleTowerPokemon unk_040[PARTY_SIZE]; -}; // size: 328 - -struct UnkSubstruct_203F458_000C -{ - /* 0x000 */ u8 unk_000; - /* 0x000 */ u8 unk_001; - /* 0x002 */ u8 unk_002; - /* 0x003 */ u8 unk_003; - /* 0x004 */ struct UnkSubstruct_203F458_000C_004 unk_004[3]; - /* 0x3DC */ u8 filler_3DC[4]; -}; - -struct Unk_203F458_Header -{ - u8 unk0; - u8 unk1; - u32 unk4; -}; - -struct UnkStruct_203F458_SaveBlock -{ - struct Unk_203F458_Header unk_0000; - struct UnkSubstruct_203F458_000C unk_0008[8]; -}; - struct UnkStruct_203F458 { /* 0x0000 */ u8 unk_0000; - /* 0x0004 */ struct UnkStruct_203F458_SaveBlock unk_0004; + /* 0x0004 */ struct TrainerTowerData unk_0004; }; struct UnkStruct_203F45C @@ -563,30 +528,7 @@ const u8 gUnknown_847A30E[][3] = { }; extern const struct Unk_203F458_Header gUnknown_84827AC; -extern const struct UnkSubstruct_203F458_000C *const gUnknown_84827B4[][8]; - -bool32 sub_815D7BC(void * dest, void * buffer) -{ - if (TryCopySpecialSaveSection(30, buffer) != 1) - return FALSE; - memcpy(dest + 0x000, buffer, 0xF88); - - if (TryCopySpecialSaveSection(31, buffer) != 1) - return FALSE; - memcpy(dest + 0xF88, buffer, 0xF80); - - if (!sub_815D6B4(dest)) - return FALSE; - return TRUE; -} - -bool32 sub_815D80C(void * dest) -{ - void * buffer = AllocZeroed(0x1000); - bool32 success = sub_815D7BC(dest, buffer); - Free(buffer); - return success; -} +extern const struct TrainerTowerTrainer *const gUnknown_84827B4[][8]; bool32 sub_815D834(void) { @@ -696,23 +638,23 @@ void sub_815DA54(void) sub_815DC8C(); gUnknown_203F45C = AllocZeroed(sizeof(*gUnknown_203F45C)); r10 = VarGet(VAR_0x4001); - StringCopyN(gUnknown_203F45C->unk_00, gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_000, 11); + StringCopyN(gUnknown_203F45C->unk_00, gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10].unk_000, 11); for (r9 = 0; r9 < 6; r9++) { - gUnknown_203F45C->unk_0C[r9] = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_01A[r9]; - gUnknown_203F45C->unk_18[r9] = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_026[r9]; + gUnknown_203F45C->unk_0C[r9] = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10].unk_01A[r9]; + gUnknown_203F45C->unk_18[r9] = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10].unk_026[r9]; - if (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002 == 1) + if (gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002 == 1) { - gUnknown_203F45C->unk_24[r9] = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10 + 1].unk_01A[r9]; - gUnknown_203F45C->unk_30[r9] = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10 + 1].unk_026[r9]; + gUnknown_203F45C->unk_24[r9] = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10 + 1].unk_01A[r9]; + gUnknown_203F45C->unk_30[r9] = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10 + 1].unk_026[r9]; } } - gUnknown_203F45C->unk_3C = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; - gUnknown_203F45C->unk_3D = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_00B; - gUnknown_203F45C->unk_3E = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r10].unk_00C; + gUnknown_203F45C->unk_3C = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002; + gUnknown_203F45C->unk_3D = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10].unk_00B; + gUnknown_203F45C->unk_3E = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r10].unk_00C; SetVBlankCounter1Ptr(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk0); sub_815DD2C(); } @@ -750,12 +692,12 @@ void sub_815DC8C(void) // fakematching { u32 whichTimer = gSaveBlock1Ptr->unkArrayIdx; s32 r4; - const struct UnkSubstruct_203F458_000C *const * r7; + const struct TrainerTowerTrainer *const * r7; gUnknown_203F458 = AllocZeroed(sizeof(*gUnknown_203F458)); gUnknown_203F458->unk_0000 = gMapHeader.mapDataId - 0x2A; if (sub_815D834() == TRUE) - sub_815D80C(&gUnknown_203F458->unk_0004); + CEReaderTool_LoadTrainerTower(&gUnknown_203F458->unk_0004); else { struct UnkStruct_203F458 * r0_ = gUnknown_203F458; @@ -767,12 +709,12 @@ void sub_815DC8C(void) // fakematching for (r4 = 0; r4 < 8; r4++) { void * r0 = gUnknown_203F458; - r0 = r4 * sizeof(struct UnkSubstruct_203F458_000C) + r0; - r0 += offsetof(struct UnkStruct_203F458, unk_0004.unk_0008); - memcpy(r0, r7[r4], sizeof(struct UnkSubstruct_203F458_000C)); + r0 = r4 * sizeof(struct TrainerTowerTrainer) + r0; + r0 += offsetof(struct UnkStruct_203F458, unk_0004.trainers); + memcpy(r0, r7[r4], sizeof(struct TrainerTowerTrainer)); // r0[r4] = *r7[r4]; } - gUnknown_203F458->unk_0004.unk_0000.unk4 = CalcByteArraySum((void *)gUnknown_203F458->unk_0004.unk_0008, sizeof(gUnknown_203F458->unk_0004.unk_0008)); + gUnknown_203F458->unk_0004.unk4 = CalcByteArraySum((void *)gUnknown_203F458->unk_0004.trainers, sizeof(gUnknown_203F458->unk_0004.trainers)); sub_815EC0C(); } } @@ -799,7 +741,7 @@ void sub_815DC8C(void) "\tbne _0815DCD0\n" "\tldr r0, [r4]\n" "\tadds r0, 0x4\n" - "\tbl sub_815D80C\n" + "\tbl CEReaderTool_LoadTrainerTower\n" "\tb _0815DD18\n" "\t.align 2, 0\n" "_0815DCBC: .4byte gSaveBlock1Ptr\n" @@ -860,14 +802,14 @@ void sub_815DD2C(void) void sub_815DD44(void) { - if (gMapHeader.mapDataId - 0x129 > gUnknown_203F458->unk_0004.unk_0000.unk0) + if (gMapHeader.mapDataId - 0x129 > gUnknown_203F458->unk_0004.count) { gSpecialVar_Result = 3; SetCurrentMapLayout(0x132); } else { - gSpecialVar_Result = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; + gSpecialVar_Result = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002; SetCurrentMapLayout(gUnknown_847A284[gUnknown_203F458->unk_0000][gSpecialVar_Result]); sub_815DDB0(); } @@ -877,10 +819,10 @@ void sub_815DDB0(void) { s32 r3, r4; u8 r1, r2, r4_; - switch (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002) + switch (gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002) { case 0: - r2 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_00B; + r2 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[0].unk_00B; for (r3 = 0; r3 < NELEMS(gUnknown_8479ED8); r3++) { if (gUnknown_8479ED8[r3].unk1 == r2) @@ -893,7 +835,7 @@ void sub_815DDB0(void) VarSet(VAR_0x4011, r1); break; case 1: - r2 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_00B; + r2 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[0].unk_00B; for (r3 = 0; r3 < NELEMS(gUnknown_847A024); r3++) { if (gUnknown_847A024[r3].unk2 == r2) @@ -915,7 +857,7 @@ void sub_815DDB0(void) case 2: for (r4 = 0; r4 < 3; r4++) { - r2 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_00B; + r2 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_00B; for (r3 = 0; r3 < NELEMS(gUnknown_8479ED8); r3++) { if (gUnknown_8479ED8[r3].unk1 == r2) @@ -962,25 +904,25 @@ void sub_815DF54(void) { u16 r4 = gSpecialVar_0x8006; u8 r1; - u8 r5 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; + u8 r5 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002; // HOW DO I MATCH THIS CONTROL FLOW?!?! - r1 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r5 == 1 ? 0 : r4].unk_00B; + r1 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r5 == 1 ? 0 : r4].unk_00B; switch (gSpecialVar_0x8005) { case 2: sub_815E068(r5, r1); - sub_815DEFC(gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_00E, gStringVar4); + sub_815DEFC(gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_00E, gStringVar4); break; case 3: sub_815E068(r5, r1); - sub_815DEFC(gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_01A, gStringVar4); + sub_815DEFC(gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_01A, gStringVar4); break; case 4: sub_815E068(r5, r1); - sub_815DEFC(gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_026, gStringVar4); + sub_815DEFC(gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_026, gStringVar4); break; case 5: - sub_815DEFC(gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_032, gStringVar4); + sub_815DEFC(gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_032, gStringVar4); break; } } @@ -1180,7 +1122,7 @@ void sub_815E124(u8 taskId) void sub_815E160(void) { gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY; - if (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002 == 1) + if (gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002 == 1) gBattleTypeFlags |= BATTLE_TYPE_DOUBLE; gTrainerBattleOpponent_A = 0; sub_815E9FC(); @@ -1192,7 +1134,7 @@ void sub_815E160(void) void sub_815E1C0(void) { if (!gSpecialVar_0x8005) - gSpecialVar_Result = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002; + gSpecialVar_Result = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002; } void sub_815E1F0(void) @@ -1203,7 +1145,7 @@ void sub_815E1F0(void) void sub_815E218(void) { u16 mapDataId = gMapHeader.mapDataId; - if (mapDataId - 0x12A == gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8 && mapDataId - 0x129 <= gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_001) + if (mapDataId - 0x12A == gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk8 && mapDataId - 0x129 <= gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_001) gSpecialVar_Result = FALSE; else gSpecialVar_Result = TRUE; @@ -1239,7 +1181,7 @@ void sub_815E394(void) void sub_815E408(void) { - u16 itemId = gUnknown_847A2B4[gUnknown_203F458->unk_0004.unk_0008->unk_003]; + u16 itemId = gUnknown_847A2B4[gUnknown_203F458->unk_0004.trainers->unk_003]; if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0) gSpecialVar_Result = 2; else if (AddBagItem(itemId, 1) == 1) @@ -1367,9 +1309,9 @@ void sub_815E8B4(void) void sub_815E8CC(void) { - if (gUnknown_203F458->unk_0004.unk_0000.unk0 != gUnknown_203F458->unk_0004.unk_0008[0].unk_001) + if (gUnknown_203F458->unk_0004.count != gUnknown_203F458->unk_0004.trainers[0].unk_001) { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_203F458->unk_0004.unk_0000.unk0, STR_CONV_MODE_LEFT_ALIGN, 1); + ConvertIntToDecimalStringN(gStringVar1, gUnknown_203F458->unk_0004.count, STR_CONV_MODE_LEFT_ALIGN, 1); gSpecialVar_Result = TRUE; } else @@ -1394,7 +1336,7 @@ void sub_815E948(void) { s32 i; u16 var_4001 = VarGet(VAR_0x4001); - u8 r1 = gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[var_4001].unk_00B; + u8 r1 = gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[var_4001].unk_00B; for (i = 0; i < NELEMS(gUnknown_847A074); i++) { @@ -1427,29 +1369,29 @@ void sub_815E9FC(void) ZeroEnemyPartyMons(); - switch (gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_002) + switch (gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_002) { case 0: default: for (r6 = 0; r6 < 2; r6++) { r2 = gUnknown_847A2EE[r5][r6]; - gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; - sub_803E0A4(&gEnemyParty[r6], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); + gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[r6], &gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); } break; case 1: r2 = gUnknown_847A2FE[r5][0]; - gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2].level = r9; - sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2]); + gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[0].unk_040[r2]); r2 = gUnknown_847A2FE[r5][1]; - gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2].level = r9; - sub_803E0A4(&gEnemyParty[1], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2]); + gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[1], &gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[1].unk_040[r2]); break; case 2: r2 = gUnknown_847A30E[r5][r4]; - gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; - sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.unk_0008[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); + gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2].level = r9; + sub_803E0A4(&gEnemyParty[0], &gUnknown_203F458->unk_0004.trainers[gUnknown_203F458->unk_0000].unk_004[r4].unk_040[r2]); break; } } @@ -1474,9 +1416,9 @@ static s32 GetPartyMaxLevel(void) void sub_815EC0C(void) { - if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 != gUnknown_203F458->unk_0004.unk_0000.unk1) + if (gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 != gUnknown_203F458->unk_0004.id) { - gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 = gUnknown_203F458->unk_0004.unk_0000.unk1; + gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk9 = gUnknown_203F458->unk_0004.id; sub_815EDF4(&gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unk4, 215999); gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_0 = FALSE; } -- cgit v1.2.3 From decd15a45876549a117df8e8594865cb42aa7b1a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 15 Jun 2019 12:56:14 -0400 Subject: unk_815EDDC --- src/trainer_tower.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 46c112030..5711bff94 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -77,6 +77,7 @@ struct UnkStruct_847A074 EWRAM_DATA struct UnkStruct_203F458 * gUnknown_203F458 = NULL; EWRAM_DATA struct UnkStruct_203F45C * gUnknown_203F45C = NULL; +EWRAM_DATA u8 unused_variable = 0; void sub_815D96C(void); void sub_815DC8C(void); // setup -- cgit v1.2.3 From 2b750cf44491aee3b2fe8265afb4ac6620500afa Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 17 Jun 2019 10:21:32 -0400 Subject: Rename Item PC symbols --- src/trainer_tower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/trainer_tower.c') diff --git a/src/trainer_tower.c b/src/trainer_tower.c index 5711bff94..ef2a12ce0 100644 --- a/src/trainer_tower.c +++ b/src/trainer_tower.c @@ -1299,7 +1299,7 @@ void sub_815E720(void) void sub_815E88C(void) { u8 windowId = VarGet(VAR_0x4001); - sub_810F4D8(windowId, TRUE); + ClearMenuWindow(windowId, TRUE); RemoveWindow(windowId); } -- cgit v1.2.3