diff options
Diffstat (limited to 'include/global.h')
-rw-r--r-- | include/global.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/global.h b/include/global.h index e88cc620b..deaf70ea7 100644 --- a/include/global.h +++ b/include/global.h @@ -5,6 +5,9 @@ #include "gba/gba.h" #include <string.h> #include "constants/global.h" +#include "constants/flags.h" +#include "constants/vars.h" +#include "constants/species.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -87,6 +90,11 @@ extern u8 gStringVar2[]; extern u8 gStringVar3[]; extern u8 gStringVar4[]; +#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0)) + +#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(NUM_SPECIES)) +#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT)) + struct Coords8 { s8 x; @@ -131,8 +139,6 @@ struct Time /*0x04*/ s8 seconds; }; -#define DEX_FLAGS_NO ((POKEMON_SLOTS_NUMBER / 8) + ((POKEMON_SLOTS_NUMBER % 8) ? 1 : 0)) - struct Pokedex { /*0x00*/ u8 order; @@ -549,8 +555,6 @@ struct QuestLogNPCData }; #define BERRY_TREES_COUNT 128 -#define FLAGS_COUNT 288 // 300 -#define VARS_COUNT 256 #define MAIL_COUNT (PARTY_SIZE + 10) #define PC_MAIL_NUM(i) (PARTY_SIZE + (i)) @@ -603,7 +607,7 @@ struct QuestLog // These arrays hold the game state for // playing back the quest log - /*0x0148*/ u8 flags[FLAGS_COUNT]; + /*0x0148*/ u8 flags[NUM_FLAG_BYTES]; /*0x02c8*/ u16 vars[VARS_COUNT]; /*0x0468*/ struct QuestLogNPCData npcData[64]; /*0x0568*/ u16 script[128]; @@ -744,7 +748,7 @@ struct SaveBlock1 /*0x063A*/ u8 ALIGNED(2) trainerRematches[100]; /*0x06A0*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT]; /*0x08E0*/ struct ObjectEventTemplate objectEventTemplates[64]; - /*0x0EE0*/ u8 flags[FLAGS_COUNT]; + /*0x0EE0*/ u8 flags[NUM_FLAG_BYTES]; /*0x1000*/ u16 vars[VARS_COUNT]; /*0x1200*/ u32 gameStats[NUM_GAME_STATS]; /*0x1300*/ struct QuestLog questLog[QUEST_LOG_SCENE_COUNT]; |