Use def_* macros for automatic map event counts

Resolves #742
This commit is contained in:
Rangi
2020-07-24 09:49:26 -04:00
parent 89c47f2170
commit dcb24bc724
392 changed files with 2750 additions and 2695 deletions

View File

@ -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