summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/global.h b/include/global.h
index 4523ece21..a76d6e4e3 100644
--- a/include/global.h
+++ b/include/global.h
@@ -2,6 +2,7 @@
#define GUARD_GLOBAL_H
#include <string.h>
+#include <limits.h>
#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"
@@ -62,6 +63,10 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
+#if MODERN
+#define abs(x) (((x) < 0) ? -(x) : (x))
+#endif
+
// Extracts the upper 16 bits of a 32-bit number
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
@@ -86,6 +91,11 @@
#define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)
+// Macros for checking the joypad
+#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 S16TOPOSFLOAT(val) \
({ \
s16 v = (val); \
@@ -235,7 +245,7 @@ struct BattleTowerPokemon
u32 spAttackIV:5;
u32 spDefenseIV:5;
u32 gap:1;
- u32 altAbility:1;
+ u32 abilityNum:1;
u32 personality;
u8 nickname[POKEMON_NAME_LENGTH + 1];
u8 friendship;
@@ -282,7 +292,7 @@ struct RentalMon
u16 monId;
u32 personality;
u8 ivs;
- u8 abilityBit;
+ u8 abilityNum;
};
struct BattleDomeTrainer