summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2022-01-05 12:18:49 -0500
committerGriffinR <griffin.g.richards@gmail.com>2022-01-05 12:18:49 -0500
commit5d033c2e4d5001c65e85fdcf5c780e5b88307063 (patch)
treea5031097d394b9493e8a9993e63a6605e7a02706 /include/global.h
parent84925a892b20b8f688d36a616366f72ed52f686f (diff)
Convert pokedex defines to enums
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 024280f98..377e20e0e 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"
@@ -125,7 +126,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)
struct Coords8
@@ -181,8 +184,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
@@ -944,7 +947,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;
@@ -1000,7 +1003,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];