summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/global.h b/include/global.h
index 230a50f55..7de8d1eb3 100644
--- a/include/global.h
+++ b/include/global.h
@@ -6,6 +6,8 @@
#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines.
#include "gba/gba.h"
#include "constants/global.h"
+#include "constants/flags.h"
+#include "constants/vars.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@@ -100,6 +102,7 @@
#define TEST_BUTTON(field, button) ({(field) & (button);})
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)
#define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
+#define JOY_REPEAT(button) TEST_BUTTON(gMain.newAndRepeatedKeys, button)
#define S16TOPOSFLOAT(val) \
({ \
@@ -109,6 +112,11 @@
f; \
})
+#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0))
+
+#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER))
+#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT))
+
struct Coords8
{
s8 x;
@@ -153,8 +161,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;
@@ -923,7 +929,7 @@ struct SaveBlock1
/*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
/*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
/*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
- /*0x1270*/ u8 flags[FLAGS_COUNT];
+ /*0x1270*/ u8 flags[NUM_FLAG_BYTES];
/*0x139C*/ u16 vars[VARS_COUNT];
/*0x159C*/ u32 gameStats[NUM_GAME_STATS];
/*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];