summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-11-24 20:04:50 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-11-24 20:04:50 -0500
commit93f67f9557109d85e191283b171f7f5e8028b7bf (patch)
tree9de4754893df84f6d11ff7bcb10f9b3e4018e840 /include/global.h
parent8ef1594d204e0b933fcfc048e17471191dfae720 (diff)
sub_812CAD8
New macro `PRESSED(x)` tests `gMain.newKeys & (x)`. The macro itself is inoptimal. However, its use is required to match this function. We suspect this macro may have been implemented globally, hence we put it in `global.h`. Propagating its use through the remainder of this project, as well as [Ruby](/pret/pokeruby) and [Emerald](/pret/pokeemerald), has been left as a to-do item.
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/global.h b/include/global.h
index 050e200f9..3dc11bfbd 100644
--- a/include/global.h
+++ b/include/global.h
@@ -62,6 +62,13 @@
#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)
+// This macro is required to prevent the compiler from optimizing
+// a dpad up/down check in sub_812CAD8 (fame_checker.c).
+// We suspect it was used globally.
+// GameFreak never ceases to amaze.
+// TODO: Propagate use of this macro
+#define PRESSED(button) ({gMain.newKeys & (button);})
+
extern u8 gStringVar1[];
extern u8 gStringVar2[];
extern u8 gStringVar3[];