summaryrefslogtreecommitdiff
path: root/macros/scripts
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-26 16:29:43 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-26 16:29:43 -0400
commitd24f1c71149b59c50dba57e500f30b223a54a25f (patch)
tree140ad8c04b396af2e0d55f3218bfb3e428391f42 /macros/scripts
parent6ca1857732502a60251e3738cbccc6d0067eaed2 (diff)
Use def_* macros for automatic map event counts
Diffstat (limited to 'macros/scripts')
-rw-r--r--macros/scripts/maps.asm60
1 files changed, 60 insertions, 0 deletions
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index edf2b421..d9ffd83e 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -5,16 +5,45 @@ ENDM
object_const_def EQUS "const_def 2"
+def_scene_scripts: MACRO
+if DEF(_NUM_SCENE_SCRIPTS)
+ PURGE _NUM_SCENE_SCRIPTS
+endc
+_NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@"
+ db _NUM_SCENE_SCRIPTS
+_NUM_SCENE_SCRIPTS = 0
+ENDM
+
scene_script: MACRO
;\1: script pointer
dw \1
dw 0 ; filler
+_NUM_SCENE_SCRIPTS = _NUM_SCENE_SCRIPTS + 1
+ENDM
+
+def_callbacks: MACRO
+if DEF(_NUM_CALLBACKS)
+ PURGE _NUM_CALLBACKS
+endc
+_NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
+ db _NUM_CALLBACKS
+_NUM_CALLBACKS = 0
ENDM
callback: MACRO
;\1: type: a MAPCALLBACK_* constant
;\2: script pointer
dbw \1, \2
+_NUM_CALLBACKS = _NUM_CALLBACKS + 1
+ENDM
+
+def_warp_events: MACRO
+if DEF(_NUM_WARP_EVENTS)
+ PURGE _NUM_WARP_EVENTS
+endc
+_NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@"
+ db _NUM_WARP_EVENTS
+_NUM_WARP_EVENTS = 0
ENDM
warp_event: MACRO
@@ -24,6 +53,16 @@ warp_event: MACRO
;\4: warp destination: starts at 1
db \2, \1, \4
map_id \3
+_NUM_WARP_EVENTS = _NUM_WARP_EVENTS + 1
+ENDM
+
+def_coord_events: MACRO
+if DEF(_NUM_COORD_EVENTS)
+ PURGE _NUM_COORD_EVENTS
+endc
+_NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@"
+ db _NUM_COORD_EVENTS
+_NUM_COORD_EVENTS = 0
ENDM
coord_event: MACRO
@@ -35,6 +74,16 @@ coord_event: MACRO
db 0 ; filler
dw \4
dw 0 ; filler
+_NUM_COORD_EVENTS = _NUM_COORD_EVENTS + 1
+ENDM
+
+def_bg_events: MACRO
+if DEF(_NUM_BG_EVENTS)
+ PURGE _NUM_BG_EVENTS
+endc
+_NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@"
+ db _NUM_BG_EVENTS
+_NUM_BG_EVENTS = 0
ENDM
bg_event: MACRO
@@ -44,6 +93,16 @@ bg_event: MACRO
;\4: script pointer
db \2, \1, \3
dw \4
+_NUM_BG_EVENTS = _NUM_BG_EVENTS + 1
+ENDM
+
+def_object_events: MACRO
+if DEF(_NUM_OBJECT_EVENTS)
+ PURGE _NUM_OBJECT_EVENTS
+endc
+_NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@"
+ db _NUM_OBJECT_EVENTS
+_NUM_OBJECT_EVENTS = 0
ENDM
object_event: MACRO
@@ -74,6 +133,7 @@ object_event: MACRO
dw \9
shift
dw \9
+_NUM_OBJECT_EVENTS = _NUM_OBJECT_EVENTS + 1
ENDM
trainer: MACRO