From 0ca0ad1c63e49605d3a9dd28e5c40bca96a85710 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Mon, 12 Feb 2018 15:42:15 +0530 Subject: Decompile birch_pc.c --- 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..bc8095592 --- /dev/null +++ b/src/birch_pc.c @@ -0,0 +1,114 @@ +#include "global.h" +#include "event_data.h" +#include "field_message_box.h" +#include "pokedex.h" +#include "constants/species.h" + +extern u16 gSpecialVar_0x8004; +extern u16 gSpecialVar_0x8005; +extern u16 gSpecialVar_0x8006; + +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 == 0) // is national dex not present? + { + gSpecialVar_0x8005 = sub_80C0844(0); + gSpecialVar_0x8006 = sub_80C0844(1); + } + else + { + gSpecialVar_0x8005 = pokedex_count(0); + gSpecialVar_0x8006 = pokedex_count(1); + } + + return IsNationalPokedexEnabled(); +} + +// This shows your Hoenn Pokedex rating and not your National Dex. +const u8 *GetPokedexRatingText(u16 count) +{ + if (count < 10) + return gBirchDexRatingText_LessThan10; + if (count < 20) + return gBirchDexRatingText_LessThan20; + if (count < 30) + return gBirchDexRatingText_LessThan30; + if (count < 40) + return gBirchDexRatingText_LessThan40; + if (count < 50) + return gBirchDexRatingText_LessThan50; + if (count < 60) + return gBirchDexRatingText_LessThan60; + if (count < 70) + return gBirchDexRatingText_LessThan70; + if (count < 80) + return gBirchDexRatingText_LessThan80; + if (count < 90) + return gBirchDexRatingText_LessThan90; + if (count < 100) + return gBirchDexRatingText_LessThan100; + if (count < 110) + return gBirchDexRatingText_LessThan110; + if (count < 120) + return gBirchDexRatingText_LessThan120; + if (count < 130) + return gBirchDexRatingText_LessThan130; + if (count < 140) + return gBirchDexRatingText_LessThan140; + if (count < 150) + return gBirchDexRatingText_LessThan150; + if (count < 160) + return gBirchDexRatingText_LessThan160; + if (count < 170) + return gBirchDexRatingText_LessThan170; + if (count < 180) + return gBirchDexRatingText_LessThan180; + if (count < 190) + return gBirchDexRatingText_LessThan190; + if (count < 200) + return gBirchDexRatingText_LessThan200; + if (count == 200) + { + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + || GetSetPokedexFlag(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 (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + && GetSetPokedexFlag(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; // Hoenn dex is considered complete, even though the hoenn dex count is 210. + return gBirchDexRatingText_LessThan10; +} + +void ShowPokedexRatingMessage(void) +{ + ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004)); +} -- cgit v1.2.3 From d52a54e64f73cb1e24e18da106ea9b69307b4509 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Mon, 12 Feb 2018 16:15:51 +0530 Subject: Updating pokedex count function labels --- src/birch_pc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index bc8095592..4b0025504 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -34,13 +34,13 @@ bool16 ScriptGetPokedexInfo(void) { if (gSpecialVar_0x8004 == 0) // is national dex not present? { - gSpecialVar_0x8005 = sub_80C0844(0); - gSpecialVar_0x8006 = sub_80C0844(1); + gSpecialVar_0x8005 = GetHoennPokedexCount(0); + gSpecialVar_0x8006 = GetHoennPokedexCount(1); } else { - gSpecialVar_0x8005 = pokedex_count(0); - gSpecialVar_0x8006 = pokedex_count(1); + gSpecialVar_0x8005 = GetNationalPokedexCount(0); + gSpecialVar_0x8006 = GetNationalPokedexCount(1); } return IsNationalPokedexEnabled(); -- cgit v1.2.3 From 7b360b2e338e4f2a008374a0114367dadf728484 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Tue, 13 Feb 2018 09:16:38 +0530 Subject: Review fixes --- src/birch_pc.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/birch_pc.c') diff --git a/src/birch_pc.c b/src/birch_pc.c index 4b0025504..a682d15d9 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -3,33 +3,12 @@ #include "field_message_box.h" #include "pokedex.h" #include "constants/species.h" +#include "text.h" extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; extern u16 gSpecialVar_0x8006; -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 == 0) // is national dex not present? -- cgit v1.2.3 From ae321d6e7c99b557cafd594eb945e7ca1a566ba8 Mon Sep 17 00:00:00 2001 From: KDSKardabox Date: Tue, 13 Feb 2018 09:32:40 +0530 Subject: move to strings.h --- 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 a682d15d9..0f44824f7 100644 --- a/src/birch_pc.c +++ b/src/birch_pc.c @@ -3,7 +3,7 @@ #include "field_message_box.h" #include "pokedex.h" #include "constants/species.h" -#include "text.h" +#include "strings.h" extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; -- cgit v1.2.3