mirror of
https://github.com/pret/pokecrystal.git
synced 2026-03-21 17:45:29 -05:00
Verify that only one of each callback type exists per map
Some checks failed
CI / build (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
Fixes #1213
This commit is contained in:
parent
f9ba82248e
commit
a718a256f8
|
|
@ -22,6 +22,7 @@ DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
|
|||
const MAPCALLBACK_CMDQUEUE
|
||||
const MAPCALLBACK_SPRITES
|
||||
const MAPCALLBACK_NEWMAP
|
||||
DEF NUM_MAPCALLBACK_TYPES EQU const_value - 1
|
||||
|
||||
; see data/maps/setup_script_pointers.asm
|
||||
DEF MAPSETUPSCRIPT_HAS_PARAM_F EQU 7
|
||||
|
|
|
|||
|
|
@ -39,11 +39,17 @@ MACRO def_callbacks
|
|||
REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
|
||||
db {_NUM_CALLBACKS}
|
||||
DEF {_NUM_CALLBACKS} = 0
|
||||
for x, 1, NUM_MAPCALLBACK_TYPES + 1
|
||||
DEF map_callback_{d:x} = 0
|
||||
endr
|
||||
ENDM
|
||||
|
||||
MACRO callback
|
||||
;\1: type: a MAPCALLBACK_* constant
|
||||
;\2: script pointer
|
||||
DEF x = \1
|
||||
assert !map_callback_{d:x}, "Already defined a `callback \1` for this map"
|
||||
DEF map_callback_{d:x} = 1
|
||||
dbw \1, \2
|
||||
DEF {_NUM_CALLBACKS} += 1
|
||||
ENDM
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user