summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcadmic <cadmic24@gmail.com>2024-09-06 01:24:19 -0700
committerGitHub <noreply@github.com>2024-09-06 10:24:19 +0200
commit3faa1c6acce3b317ee23f153d17f0ea66a8f1c79 (patch)
treec08960694a02b5d79a3d6de7e44113b8d0abbbfe /include
parentbb6177e936c535817eded229d1023d0556a67519 (diff)
Move button macros to include/controller.h (#2138)
* Move button macros to include/controller.h * Fix z_mag button ordering
Diffstat (limited to 'include')
-rw-r--r--include/controller.h27
-rw-r--r--include/macros.h8
-rw-r--r--include/ultra64/controller.h16
-rw-r--r--include/z64.h1
4 files changed, 28 insertions, 24 deletions
diff --git a/include/controller.h b/include/controller.h
new file mode 100644
index 000000000..dbc850aa2
--- /dev/null
+++ b/include/controller.h
@@ -0,0 +1,27 @@
+#ifndef CONTROLLER_H
+#define CONTROLLER_H
+
+#define BTN_A 0x8000
+#define BTN_B 0x4000
+#define BTN_Z 0x2000
+#define BTN_START 0x1000
+#define BTN_DUP 0x0800
+#define BTN_DDOWN 0x0400
+#define BTN_DLEFT 0x0200
+#define BTN_DRIGHT 0x0100
+#define BTN_L 0x0020
+#define BTN_R 0x0010
+#define BTN_CUP 0x0008
+#define BTN_CDOWN 0x0004
+#define BTN_CLEFT 0x0002
+#define BTN_CRIGHT 0x0001
+
+#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)
+
+#if PLATFORM_N64
+#define CHECK_BTN_ALL(state, combo) (((state) & (combo)) == (combo))
+#else
+#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
+#endif
+
+#endif
diff --git a/include/macros.h b/include/macros.h
index 126d5d990..50f833028 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -105,14 +105,6 @@
? gSaveContext.save.info.equips.buttonItems[(button) + 1] \
: ITEM_NONE)
-#if PLATFORM_N64
-#define CHECK_BTN_ALL(state, combo) (((state) & (combo)) == (combo))
-#else
-#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
-#endif
-
-#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)
-
#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask))
// IDO doesn't support variadic macros, but it merely throws a warning for the
diff --git a/include/ultra64/controller.h b/include/ultra64/controller.h
index 79dcf1c47..4ce047a20 100644
--- a/include/ultra64/controller.h
+++ b/include/ultra64/controller.h
@@ -103,22 +103,6 @@
#define CONT_BLOCK_GB_BANK CONT_BLOCKS(CONT_ADDR_GB_BANK)
#define CONT_BLOCK_GB_STATUS CONT_BLOCKS(CONT_ADDR_GB_STATUS)
-/* Buttons */
-#define BTN_CRIGHT 0x0001
-#define BTN_CLEFT 0x0002
-#define BTN_CDOWN 0x0004
-#define BTN_CUP 0x0008
-#define BTN_R 0x0010
-#define BTN_L 0x0020
-#define BTN_DRIGHT 0x0100
-#define BTN_DLEFT 0x0200
-#define BTN_DDOWN 0x0400
-#define BTN_DUP 0x0800
-#define BTN_START 0x1000
-#define BTN_Z 0x2000
-#define BTN_B 0x4000
-#define BTN_A 0x8000
-
#ifdef __GNUC__
// Ensure data cache coherency for OSPifRam structures by aligning to the data cache line size.
// On older compilers such as IDO this was done by placing each OSPifRam at the top of the file it is declared in,
diff --git a/include/z64.h b/include/z64.h
index 02cdafb49..0ee9f4f08 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -5,6 +5,7 @@
#include "ultra64/gs2dex.h"
#include "attributes.h"
#include "audiomgr.h"
+#include "controller.h"
#include "z64save.h"
#include "z64light.h"
#include "z64bgcheck.h"