From 3cc8c2044525a483ba80f8730f8f6376e5f6c935 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Mon, 8 May 2017 11:28:28 -0700 Subject: decompile birch_pc --- src/birch_pc.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/birch_pc.c (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c new file mode 100644 index 000000000..89eafc0ce --- /dev/null +++ b/src/birch_pc.c @@ -0,0 +1,114 @@ +#include "global.h" +#include "asm.h" +#include "event_data.h" +#include "field_message_box.h" +#include "pokedex.h" +#include "species.h" + +extern u16 gSpecialVar_0x8004; +extern u16 gSpecialVar_0x8005; +extern u16 gSpecialVar_0x8006; + +extern const u8 gUnknown_081C4520[]; +extern const u8 gUnknown_081C456A[]; +extern const u8 gUnknown_081C45B0[]; +extern const u8 gUnknown_081C45F9[]; +extern const u8 gUnknown_081C4648[]; +extern const u8 gUnknown_081C467E[]; +extern const u8 gUnknown_081C46B9[]; +extern const u8 gUnknown_081C46FE[]; +extern const u8 gUnknown_081C4747[]; +extern const u8 gUnknown_081C4780[]; +extern const u8 gUnknown_081C47DF[]; +extern const u8 gUnknown_081C4828[]; +extern const u8 gUnknown_081C4863[]; +extern const u8 gUnknown_081C489C[]; +extern const u8 gUnknown_081C48EB[]; +extern const u8 gUnknown_081C4936[]; +extern const u8 gUnknown_081C49A2[]; +extern const u8 gUnknown_081C4A06[]; +extern const u8 gUnknown_081C4A4F[]; +extern const u8 gUnknown_081C4A91[]; +extern const u8 gUnknown_081C4ADA[]; + +bool16 ScriptGetPokedexInfo(void) +{ + if (!gSpecialVar_0x8004) + { + gSpecialVar_0x8005 = GetHoennPokedexCount(0); + gSpecialVar_0x8006 = GetHoennPokedexCount(1); + } + else + { + gSpecialVar_0x8005 = GetNationalPokedexCount(0); + gSpecialVar_0x8006 = GetNationalPokedexCount(1); + } + + return IsNationalPokedexEnabled(); +} + +const u8 *GetPokedexRatingText(u16 count) +{ + if (count < 10) + return gUnknown_081C4520; + if (count < 20) + return gUnknown_081C456A; + if (count < 30) + return gUnknown_081C45B0; + if (count < 40) + return gUnknown_081C45F9; + if (count < 50) + return gUnknown_081C4648; + if (count < 60) + return gUnknown_081C467E; + if (count < 70) + return gUnknown_081C46B9; + if (count < 80) + return gUnknown_081C46FE; + if (count < 90) + return gUnknown_081C4747; + if (count < 100) + return gUnknown_081C4780; + if (count < 110) + return gUnknown_081C47DF; + if (count < 120) + return gUnknown_081C4828; + if (count < 130) + return gUnknown_081C4863; + if (count < 140) + return gUnknown_081C489C; + if (count < 150) + return gUnknown_081C48EB; + if (count < 160) + return gUnknown_081C4936; + if (count < 170) + return gUnknown_081C49A2; + if (count < 180) + return gUnknown_081C4A06; + if (count < 190) + return gUnknown_081C4A4F; + if (count < 200) + return gUnknown_081C4A91; + if (count == 200) + { + if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + || sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) + return gUnknown_081C4A91; + return gUnknown_081C4ADA; + } + if (count == 201) + { + if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + && sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) + return gUnknown_081C4A91; + return gUnknown_081C4ADA; + } + if (count == 202) + return gUnknown_081C4ADA; + return gUnknown_081C4520; +} + +void ShowPokedexRatingMessage(void) +{ + ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004)); +} -- cgit v1.2.3 From 0354f2cc5ae9771d745e6ffadd4715bdc8ff5221 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 May 2017 01:57:43 -0400 Subject: remove unknowns from birch_pc.c --- src/birch_pc.c | 105 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index 89eafc0ce..79070b5a8 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -9,31 +9,31 @@ extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; extern u16 gSpecialVar_0x8006; -extern const u8 gUnknown_081C4520[]; -extern const u8 gUnknown_081C456A[]; -extern const u8 gUnknown_081C45B0[]; -extern const u8 gUnknown_081C45F9[]; -extern const u8 gUnknown_081C4648[]; -extern const u8 gUnknown_081C467E[]; -extern const u8 gUnknown_081C46B9[]; -extern const u8 gUnknown_081C46FE[]; -extern const u8 gUnknown_081C4747[]; -extern const u8 gUnknown_081C4780[]; -extern const u8 gUnknown_081C47DF[]; -extern const u8 gUnknown_081C4828[]; -extern const u8 gUnknown_081C4863[]; -extern const u8 gUnknown_081C489C[]; -extern const u8 gUnknown_081C48EB[]; -extern const u8 gUnknown_081C4936[]; -extern const u8 gUnknown_081C49A2[]; -extern const u8 gUnknown_081C4A06[]; -extern const u8 gUnknown_081C4A4F[]; -extern const u8 gUnknown_081C4A91[]; -extern const u8 gUnknown_081C4ADA[]; +extern const u8 gBirchDexRatingText_LessThan10[]; +extern const u8 gBirchDexRatingText_LessThan20[]; +extern const u8 gBirchDexRatingText_LessThan30[]; +extern const u8 gBirchDexRatingText_LessThan40[]; +extern const u8 gBirchDexRatingText_LessThan50[]; +extern const u8 gBirchDexRatingText_LessThan60[]; +extern const u8 gBirchDexRatingText_LessThan70[]; +extern const u8 gBirchDexRatingText_LessThan80[]; +extern const u8 gBirchDexRatingText_LessThan90[]; +extern const u8 gBirchDexRatingText_LessThan100[]; +extern const u8 gBirchDexRatingText_LessThan110[]; +extern const u8 gBirchDexRatingText_LessThan120[]; +extern const u8 gBirchDexRatingText_LessThan130[]; +extern const u8 gBirchDexRatingText_LessThan140[]; +extern const u8 gBirchDexRatingText_LessThan150[]; +extern const u8 gBirchDexRatingText_LessThan160[]; +extern const u8 gBirchDexRatingText_LessThan170[]; +extern const u8 gBirchDexRatingText_LessThan180[]; +extern const u8 gBirchDexRatingText_LessThan190[]; +extern const u8 gBirchDexRatingText_LessThan200[]; +extern const u8 gBirchDexRatingText_DexCompleted[]; bool16 ScriptGetPokedexInfo(void) { - if (!gSpecialVar_0x8004) + if (gSpecialVar_0x8004 == 0) // is national dex not present? { gSpecialVar_0x8005 = GetHoennPokedexCount(0); gSpecialVar_0x8006 = GetHoennPokedexCount(1); @@ -47,65 +47,66 @@ bool16 ScriptGetPokedexInfo(void) return IsNationalPokedexEnabled(); } +// This shows your Hoenn Pokedex rating and NOT your National Dex. const u8 *GetPokedexRatingText(u16 count) { if (count < 10) - return gUnknown_081C4520; + return gBirchDexRatingText_LessThan10; if (count < 20) - return gUnknown_081C456A; + return gBirchDexRatingText_LessThan20; if (count < 30) - return gUnknown_081C45B0; + return gBirchDexRatingText_LessThan30; if (count < 40) - return gUnknown_081C45F9; + return gBirchDexRatingText_LessThan40; if (count < 50) - return gUnknown_081C4648; + return gBirchDexRatingText_LessThan50; if (count < 60) - return gUnknown_081C467E; + return gBirchDexRatingText_LessThan60; if (count < 70) - return gUnknown_081C46B9; + return gBirchDexRatingText_LessThan70; if (count < 80) - return gUnknown_081C46FE; + return gBirchDexRatingText_LessThan80; if (count < 90) - return gUnknown_081C4747; + return gBirchDexRatingText_LessThan90; if (count < 100) - return gUnknown_081C4780; + return gBirchDexRatingText_LessThan100; if (count < 110) - return gUnknown_081C47DF; + return gBirchDexRatingText_LessThan110; if (count < 120) - return gUnknown_081C4828; + return gBirchDexRatingText_LessThan120; if (count < 130) - return gUnknown_081C4863; + return gBirchDexRatingText_LessThan130; if (count < 140) - return gUnknown_081C489C; + return gBirchDexRatingText_LessThan140; if (count < 150) - return gUnknown_081C48EB; + return gBirchDexRatingText_LessThan150; if (count < 160) - return gUnknown_081C4936; + return gBirchDexRatingText_LessThan160; if (count < 170) - return gUnknown_081C49A2; + return gBirchDexRatingText_LessThan170; if (count < 180) - return gUnknown_081C4A06; + return gBirchDexRatingText_LessThan180; if (count < 190) - return gUnknown_081C4A4F; + return gBirchDexRatingText_LessThan190; if (count < 200) - return gUnknown_081C4A91; + return gBirchDexRatingText_LessThan200; if (count == 200) { - if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - || sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) - return gUnknown_081C4A91; - return gUnknown_081C4ADA; + if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + || GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. + return gBirchDexRatingText_LessThan200; + return gBirchDexRatingText_DexCompleted; } if (count == 201) { - if (sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - && sub_8090D90(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) - return gUnknown_081C4A91; - return gUnknown_081C4ADA; + if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + && GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) + return gBirchDexRatingText_LessThan200; + return gBirchDexRatingText_DexCompleted; } if (count == 202) - return gUnknown_081C4ADA; - return gUnknown_081C4520; + return gBirchDexRatingText_DexCompleted; + return gBirchDexRatingText_LessThan10; } void ShowPokedexRatingMessage(void) -- cgit v1.2.3 From ac021a863dfc9672933d6f4ac2a8978a8dd457c0 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 May 2017 02:15:34 -0400 Subject: more comments on birch_pc.c --- src/birch_pc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index 79070b5a8..df6ebc6ea 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -93,19 +93,19 @@ const u8 *GetPokedexRatingText(u16 count) if (count == 200) { if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - || GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. + || GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } if (count == 201) { if (GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) - && GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) + && GetNationalPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200. return gBirchDexRatingText_LessThan200; return gBirchDexRatingText_DexCompleted; } if (count == 202) - return gBirchDexRatingText_DexCompleted; + return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210. return gBirchDexRatingText_LessThan10; } -- cgit v1.2.3 From f999ebede0e0012cc68be71841edd3910168c105 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 May 2017 02:15:51 -0400 Subject: actually update the file --- src/birch_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index df6ebc6ea..f01107b3d 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -47,7 +47,7 @@ bool16 ScriptGetPokedexInfo(void) return IsNationalPokedexEnabled(); } -// This shows your Hoenn Pokedex rating and NOT your National Dex. +// This shows your Hoenn Pokedex rating and not your National Dex. const u8 *GetPokedexRatingText(u16 count) { if (count < 10) -- cgit v1.2.3 From 4d2b22a899c11dfcacfec6889968ab01655a3fe3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Fri, 26 May 2017 14:53:51 +0200 Subject: Add headers --- src/birch_pc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index 89eafc0ce..4a83c048f 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -1,5 +1,4 @@ #include "global.h" -#include "asm.h" #include "event_data.h" #include "field_message_box.h" #include "pokedex.h" -- cgit v1.2.3