diff options
| author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-07-26 16:31:02 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-26 16:31:02 -0400 | 
| commit | 553cb9bc82e751da5fa940d797aaf474d998f8a4 (patch) | |
| tree | c3a35971e9c5bbd274d61728f2cf4882eb65e40c /macros | |
| parent | 89c47f21701caf32641573264d83ca16eb0aed91 (diff) | |
| parent | 35821ec58c244be1f5cb670e07873e8a875c10a5 (diff) | |
Merge pull request #754 from Rangi42/master
Use def_* macros for automatic map event counts
Diffstat (limited to 'macros')
| -rw-r--r-- | macros/legacy.asm | 18 | ||||
| -rw-r--r-- | macros/scripts/maps.asm | 60 | 
2 files changed, 66 insertions, 12 deletions
| diff --git a/macros/legacy.asm b/macros/legacy.asm index 6ff29fc5f..a561b3fca 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -223,18 +223,12 @@ signpost: MACRO  ENDM  person_event: MACRO -;	object_event \3, \2, \1, \4, \5, \6, \7, \8, \9, \10, \11, \12, \13 -	db \1, \2 + 4, \3 + 4, \4 -	dn \6, \5 -	db \7, \8 -	shift -	dn \8, \9 -	shift -	db \9 -	shift -	dw \9 -	shift -	dw \9 +_s = \1 +_y = \2 +_x = \3 +_m = \4 +	shift 4 +	object_event _x, _y, _s, _m, \1, \2, \3, \4, \5, \6, \7, \8, \9  ENDM  PERSONTYPE_SCRIPT   EQUS "OBJECTTYPE_SCRIPT" diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index edf2b4213..d9ffd83e1 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 | 
