summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/global.h b/include/global.h
index ca5f50916..51ecbcbce 100644
--- a/include/global.h
+++ b/include/global.h
@@ -9,6 +9,7 @@
#include "constants/flags.h"
#include "constants/vars.h"
#include "constants/species.h"
+#include "constants/pokedex.h"
#include "constants/berry.h"
#include "constants/maps.h"
#include "constants/pokemon.h"
@@ -127,7 +128,9 @@
#define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8)
-#define DEX_FLAGS_NO ROUND_BITS_TO_BYTES(NUM_SPECIES)
+// NUM_DEX_FLAG_BYTES allocates more flags than it needs to, as NUM_SPECIES includes the "old unown"
+// values that don't appear in the Pokedex. NATIONAL_DEX_COUNT does not include these values.
+#define NUM_DEX_FLAG_BYTES ROUND_BITS_TO_BYTES(NUM_SPECIES)
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
#define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES)
@@ -184,8 +187,8 @@ struct Pokedex
/*0x04*/ u32 unownPersonality; // set when you first see Unown
/*0x08*/ u32 spindaPersonality; // set when you first see Spinda
/*0x0C*/ u32 unknown3;
- /*0x10*/ u8 owned[DEX_FLAGS_NO];
- /*0x44*/ u8 seen[DEX_FLAGS_NO];
+ /*0x10*/ u8 owned[NUM_DEX_FLAG_BYTES];
+ /*0x44*/ u8 seen[NUM_DEX_FLAG_BYTES];
};
struct PokemonJumpRecords
@@ -947,7 +950,7 @@ struct SaveBlock1
/*0x690*/ struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT];
/*0x790*/ struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT];
/*0x848*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT];
- /*0x988*/ u8 seen1[DEX_FLAGS_NO];
+ /*0x988*/ u8 seen1[NUM_DEX_FLAG_BYTES];
/*0x9BC*/ u16 berryBlenderRecords[3];
/*0x9C2*/ u8 unused_9C2[6];
/*0x9C8*/ u16 trainerRematchStepCounter;
@@ -1003,7 +1006,7 @@ struct SaveBlock1
/*0x3718*/ u32 trainerHillTimes[4];
/*0x3728*/ struct RamScript ramScript;
/*0x3B14*/ struct RecordMixingGift recordMixingGift;
- /*0x3B24*/ u8 seen2[DEX_FLAGS_NO];
+ /*0x3B24*/ u8 seen2[NUM_DEX_FLAG_BYTES];
/*0x3B58*/ LilycoveLady lilycoveLady;
/*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20];
/*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];