mirror of
https://github.com/pret/pokeemerald.git
synced 2026-09-27 04:16:47 -05:00
Untangled TMs and HMs from item ids (#7173)
This commit is contained in:
@@ -26,8 +26,9 @@
|
||||
#define STR(...) STR_(__VA_ARGS__)
|
||||
#define STR_(...) #__VA_ARGS__
|
||||
|
||||
/* You'll never guess what this one does */
|
||||
/* You'll never guess what these do */
|
||||
#define APPEND_SEMICOLON(a) a;
|
||||
#define APPEND_COMMA(a) a,
|
||||
|
||||
/* Converts a string to a compound literal, essentially making it a pointer to const u8 */
|
||||
#define COMPOUND_STRING(str) (const u8[]) _(str)
|
||||
@@ -98,6 +99,21 @@
|
||||
#define R_FOR_EACH_WITH_(macro, args, a, ...) INVOKE_WITH(macro, args, a) __VA_OPT__(R_FOR_EACH_WITH_P PARENS (macro, args, __VA_ARGS__))
|
||||
#define R_FOR_EACH_WITH_P() R_FOR_EACH_WITH_
|
||||
|
||||
/* Expands to 'macro(a, b)' for each 'a' in 'as' and 'b' in 'bs'.
|
||||
* Uses the shorter of 'as' and 'bs'. (Credit to MGriffin) */
|
||||
#define R_ZIP(macro, as, bs) CAT(R_ZIP_, CAT(R_ZIP_NONEMPTY(as), R_ZIP_NONEMPTY(bs)))(macro, FIRST as, FIRST bs, (EXCEPT_1 as), (EXCEPT_1 bs))
|
||||
#define R_ZIP_00(macro, a, b, as, bs)
|
||||
#define R_ZIP_01(macro, a, b, as, bs)
|
||||
#define R_ZIP_10(macro, a, b, as, bs)
|
||||
#define R_ZIP_11(macro, a, b, as, bs) macro(a, b) R_ZIP_P PARENS (macro, as, bs)
|
||||
#define R_ZIP_P() R_ZIP
|
||||
|
||||
#define R_ZIP_NONEMPTY(as) R_ZIP_NONEMPTY_ as
|
||||
#define R_ZIP_NONEMPTY_(...) FIRST(__VA_OPT__(1,) 0)
|
||||
|
||||
/* Just a lot of numbers (with leading zeroes - remove with REMOVE_LEADING_ZEROES) */
|
||||
#define NUMBERS_256 (00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255)
|
||||
|
||||
/* Picks the xth VA_ARG if it exists, otherwise returns a default value */
|
||||
#define DEFAULT(_default, ...) FIRST(__VA_OPT__(__VA_ARGS__, ) _default)
|
||||
#define DEFAULT_2(_default, ...) DEFAULT(_default __VA_OPT__(, SECOND(__VA_ARGS__)))
|
||||
@@ -171,4 +187,10 @@ Input must be of the form (upper << lower) where upper can be up to 3, lower up
|
||||
/* Finds the required digits to display the number (maximum 4) */
|
||||
#define MAX_DIGITS(_num) 1 + !!(_num / 10) + !!(_num / 100) + !!(_num / 1000)
|
||||
|
||||
/* Converts a number with leading zeroes to a normal int (base 10 and up to three digits only!) */
|
||||
#define REMOVE_LEADING_ZEROES(_num) (((0x##_num / 256) * 100) + ((0x##_num / 16) * 10) + (0x##_num % 16))
|
||||
|
||||
/* Useful for counting arguments */
|
||||
#define PLUS_ONE(...) + 1
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user