summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/macros/event.inc12
-rw-r--r--include/constants/vars.h6
2 files changed, 10 insertions, 8 deletions
diff --git a/asm/macros/event.inc b/asm/macros/event.inc
index 8b43d0821..951e295a6 100644
--- a/asm/macros/event.inc
+++ b/asm/macros/event.inc
@@ -233,14 +233,12 @@
.endm
@ Generic compare macro which attempts to deduce argument types based on their values
- @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
- .macro compare arg1:req, arg2:req
- .if ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8)
- compare_var_to_var \arg1, \arg2
- .elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF)
- compare_var_to_value \arg1, \arg2
+ @ Any values between 0x4000 to 0x40FF and 0x8000 to 0x8015 are considered event variable identifiers
+ .macro compare var:req, arg:req
+ .if (\arg >= VARS_START && \arg <= VARS_END) || (\arg >= SPECIAL_VARS_START && \arg <= SPECIAL_VARS_END)
+ compare_var_to_var \var, \arg
.else
- .error "Invalid arguments for 'compare'"
+ compare_var_to_value \var, \arg
.endif
.endm
diff --git a/include/constants/vars.h b/include/constants/vars.h
index d2782116f..7f622b6e3 100644
--- a/include/constants/vars.h
+++ b/include/constants/vars.h
@@ -273,7 +273,9 @@
#define VAR_UNUSED_0x40FE 0x40FE // Unused Var
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
-#define SPECIAL_VARS_START 0x8000
+#define VARS_END 0x40FF
+
+#define SPECIAL_VARS_START 0x8000
// special vars
// They are commonly used as parameters to commands, or return values from commands.
#define VAR_0x8000 0x8000
@@ -299,4 +301,6 @@
#define VAR_UNUSED_0x8014 0x8014
#define VAR_TRAINER_BATTLE_OPPONENT_A 0x8015 // Alias of gTrainerBattleOpponent_A
+#define SPECIAL_VARS_END 0x8015
+
#endif // GUARD_CONSTANTS_VARS_H