summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-08-04 15:35:35 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-08-04 15:35:35 -0400
commitcd876292d126c339bfc31c717d5bec6fe1b63f80 (patch)
treee7e3666bc80640d9b946f79c07e8d0858600598b /include/global.h
parenta08cbaee0a5f06f2e6d11ceb958e36430175f220 (diff)
parentfa5bfc16279fe6c8c38392612796448495da896f (diff)
Merge branch 'master' into pokenav_unk_2
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/include/global.h b/include/global.h
index 4523ece21..16f08c895 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"
@@ -18,12 +19,15 @@
#if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER)
#define _(x) x
#define __(x) x
-#define INCBIN_U8 {0}
-#define INCBIN_U16 {0}
-#define INCBIN_U32 {0}
-#define INCBIN_S8 {0}
-#define INCBIN_S16 {0}
-#define INCBIN_S32 {0}
+
+// Fool CLion IDE
+#define INCBIN(x) {0}
+#define INCBIN_U8 INCBIN
+#define INCBIN_U16 INCBIN
+#define INCBIN_U32 INCBIN
+#define INCBIN_S8 INCBIN
+#define INCBIN_S16 INCBIN
+#define INCBIN_S32 INCBIN
#endif // IDE support
#define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0]))
@@ -62,6 +66,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 +94,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); \
@@ -153,18 +166,17 @@ struct Pokedex
/*0x44*/ u8 seen[DEX_FLAGS_NO];
};
-struct PokemonJumpResults // possibly used in the game itself?
+struct PokemonJumpResults
{
u16 jumpsInRow;
u16 field2;
u16 excellentsInRow;
u16 field6;
- u16 field8;
- u16 fieldA;
+ u32 field8;
u32 bestJumpScore;
};
-struct BerryPickingResults // possibly used in the game itself? Size may be wrong as well
+struct BerryPickingResults
{
u32 bestScore;
u16 berriesPicked;
@@ -235,7 +247,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 +294,7 @@ struct RentalMon
u16 monId;
u32 personality;
u8 ivs;
- u8 abilityBit;
+ u8 abilityNum;
};
struct BattleDomeTrainer