2022-06-06 14:25:42 -07:00
|
|
|
MACRO map_id
|
2017-12-13 21:36:24 -08:00
|
|
|
;\1: map id
|
2020-10-26 19:24:38 -07:00
|
|
|
assert DEF(GROUP_\1) && DEF(MAP_\1), \
|
|
|
|
"Missing 'map_const \1' in constants/map_constants.asm"
|
2017-12-13 21:36:24 -08:00
|
|
|
db GROUP_\1, MAP_\1
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF object_const_def EQUS "const_def 2"
|
2019-04-21 14:42:25 -07:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_scene_scripts
|
|
|
|
REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_SCENE_SCRIPTS}
|
2022-07-29 14:43:10 -07:00
|
|
|
const_def
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_SCENE_SCRIPTS} = 0
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2022-07-29 14:43:10 -07:00
|
|
|
MACRO scene_const
|
|
|
|
;\1: scene id constant
|
|
|
|
const \1
|
|
|
|
EXPORT \1
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO scene_script
|
2017-12-13 21:36:24 -08:00
|
|
|
;\1: script pointer
|
2022-07-29 14:43:10 -07:00
|
|
|
;\2: scene id constant
|
2018-02-01 12:19:27 -08:00
|
|
|
dw \1
|
|
|
|
dw 0 ; filler
|
2022-07-29 14:43:10 -07:00
|
|
|
if _NARG == 2
|
|
|
|
scene_const \2
|
|
|
|
else
|
|
|
|
const_skip
|
|
|
|
endc
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_SCENE_SCRIPTS} += 1
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_callbacks
|
|
|
|
REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_CALLBACKS}
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_CALLBACKS} = 0
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO callback
|
2018-01-12 21:47:38 -08:00
|
|
|
;\1: type: a MAPCALLBACK_* constant
|
|
|
|
;\2: script pointer
|
|
|
|
dbw \1, \2
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_CALLBACKS} += 1
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_warp_events
|
|
|
|
REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_WARP_EVENTS}
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_WARP_EVENTS} = 0
|
2018-01-12 21:47:38 -08:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO warp_event
|
2017-12-28 11:31:25 -08:00
|
|
|
;\1: x: left to right, starts at 0
|
|
|
|
;\2: y: top to bottom, starts at 0
|
2018-02-01 18:54:00 -08:00
|
|
|
;\3: map id: from constants/map_constants.asm
|
|
|
|
;\4: warp destination: starts at 1
|
|
|
|
db \2, \1, \4
|
2018-02-03 13:58:49 -08:00
|
|
|
map_id \3
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_WARP_EVENTS} += 1
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2023-11-16 08:20:13 -08:00
|
|
|
MACRO def_anchor_events
|
|
|
|
REDEF _NUM_ANCHOR_EVENTS EQUS "_NUM_ANCHOR_EVENTS_\@"
|
|
|
|
db {_NUM_ANCHOR_EVENTS}
|
|
|
|
DEF {_NUM_ANCHOR_EVENTS} = 0
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
MACRO anchor_event
|
|
|
|
;\1: x coord
|
|
|
|
;\2: y coord
|
|
|
|
;\3: next space
|
|
|
|
; there is no \4. An anchor point can't act as an space with an effect (neither as a branch space)
|
|
|
|
db \1, \2, \3
|
|
|
|
DEF {_NUM_ANCHOR_EVENTS} += 1
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_coord_events
|
|
|
|
REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_COORD_EVENTS}
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_COORD_EVENTS} = 0
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO coord_event
|
2017-12-28 11:31:25 -08:00
|
|
|
;\1: x: left to right, starts at 0
|
2017-12-13 21:36:24 -08:00
|
|
|
;\2: y: top to bottom, starts at 0
|
2018-02-01 12:19:27 -08:00
|
|
|
;\3: scene id: a SCENE_* constant; controlled by setscene/setmapscene
|
2017-12-13 21:36:24 -08:00
|
|
|
;\4: script pointer
|
2018-01-12 21:47:38 -08:00
|
|
|
db \3, \2, \1
|
|
|
|
db 0 ; filler
|
2017-12-13 21:36:24 -08:00
|
|
|
dw \4
|
2019-03-03 11:19:16 -08:00
|
|
|
dw 0 ; filler
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_COORD_EVENTS} += 1
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_bg_events
|
|
|
|
REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_BG_EVENTS}
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_BG_EVENTS} = 0
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO bg_event
|
2017-12-28 11:31:25 -08:00
|
|
|
;\1: x: left to right, starts at 0
|
|
|
|
;\2: y: top to bottom, starts at 0
|
2017-12-24 10:46:34 -08:00
|
|
|
;\3: function: a BGEVENT_* constant
|
2017-12-13 21:36:24 -08:00
|
|
|
;\4: script pointer
|
2017-12-28 11:31:25 -08:00
|
|
|
db \2, \1, \3
|
2017-12-13 21:36:24 -08:00
|
|
|
dw \4
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_BG_EVENTS} += 1
|
2020-07-24 06:49:26 -07:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO def_object_events
|
|
|
|
REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@"
|
2021-04-19 13:31:37 -07:00
|
|
|
db {_NUM_OBJECT_EVENTS}
|
2022-06-06 14:25:42 -07:00
|
|
|
DEF {_NUM_OBJECT_EVENTS} = 0
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO object_event
|
2017-12-28 11:31:25 -08:00
|
|
|
;\1: x: left to right, starts at 0
|
2017-12-13 21:36:24 -08:00
|
|
|
;\2: y: top to bottom, starts at 0
|
2017-12-28 11:31:25 -08:00
|
|
|
;\3: sprite: a SPRITE_* constant
|
2017-12-13 21:36:24 -08:00
|
|
|
;\4: movement function: a SPRITEMOVEDATA_* constant
|
2017-12-28 11:31:25 -08:00
|
|
|
;\5, \6: movement radius: x, y
|
2017-12-24 14:35:33 -08:00
|
|
|
;\7, \8: hour limits: h1, h2 (0-23)
|
|
|
|
; * if h1 < h2, the object_event will only appear from h1 to h2
|
|
|
|
; * if h1 > h2, the object_event will not appear from h2 to h1
|
|
|
|
; * if h1 == h2, the object_event will always appear
|
|
|
|
; * if h1 == -1, h2 is treated as a time-of-day value:
|
2017-12-22 22:19:34 -08:00
|
|
|
; a combo of MORN, DAY, and/or NITE, or -1 to always appear
|
2023-01-03 19:16:08 -08:00
|
|
|
;\9: palette: a PAL_NPC_* constant, or 0 for sprite default
|
2021-05-09 09:26:28 -07:00
|
|
|
;\<10>: function: a OBJECTTYPE_* constant
|
|
|
|
;\<11>: sight range: applies to OBJECTTYPE_TRAINER
|
|
|
|
;\<12>: script pointer
|
|
|
|
;\<13>: event flag: an EVENT_* constant, or -1 to always appear
|
2017-12-28 11:31:25 -08:00
|
|
|
db \3, \2 + 4, \1 + 4, \4
|
|
|
|
dn \6, \5
|
2017-12-13 21:36:24 -08:00
|
|
|
db \7, \8
|
2021-05-09 09:26:28 -07:00
|
|
|
dn \9, \<10>
|
|
|
|
db \<11>
|
|
|
|
dw \<12>, \<13>
|
2022-06-06 14:25:42 -07:00
|
|
|
; the dummy PlayerObjectTemplate object_event has no def_object_events
|
|
|
|
if DEF(_NUM_OBJECT_EVENTS)
|
|
|
|
DEF {_NUM_OBJECT_EVENTS} += 1
|
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2023-10-17 09:27:28 -07:00
|
|
|
MACRO space
|
|
|
|
;\1: x coord
|
|
|
|
;\2: y coord
|
2023-10-28 10:09:58 -07:00
|
|
|
; [non-branch space]
|
2023-10-17 09:27:28 -07:00
|
|
|
;\3: effect (space type specific)
|
|
|
|
;\4: next space
|
2023-10-28 10:09:58 -07:00
|
|
|
; [branch space]
|
|
|
|
;\3: pointer to branch struct
|
|
|
|
db \1, \2
|
|
|
|
if _NARG == 4
|
|
|
|
db \3, \4
|
|
|
|
else
|
|
|
|
dw \3
|
|
|
|
endc
|
2023-10-17 09:27:28 -07:00
|
|
|
ENDM
|
|
|
|
|
2023-10-28 11:57:59 -07:00
|
|
|
MACRO branchdir
|
2024-02-19 08:10:33 -08:00
|
|
|
assert (_NARG - 2) == (NUM_TECHNIQUES + 7) / 8
|
|
|
|
DEF techniques_byte = 0
|
2023-10-28 11:57:59 -07:00
|
|
|
if !STRCMP("\1", "RIGHT")
|
|
|
|
DEF _NEXT_SPACE_RIGHT = \2
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF _TECHNIQUES_RIGHT = TRUE
|
|
|
|
rept _NARG - 2
|
|
|
|
DEF _TECHNIQUES_RIGHT_{d:techniques_byte} = \3
|
|
|
|
shift
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
elif !STRCMP("\1", "LEFT")
|
|
|
|
DEF _NEXT_SPACE_LEFT = \2
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF _TECHNIQUES_LEFT = TRUE
|
|
|
|
rept _NARG - 2
|
|
|
|
DEF _TECHNIQUES_LEFT_{d:techniques_byte} = \3
|
|
|
|
shift
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
elif !STRCMP("\1", "UP")
|
|
|
|
DEF _NEXT_SPACE_UP = \2
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF _TECHNIQUES_UP = TRUE
|
|
|
|
rept _NARG - 2
|
|
|
|
DEF _TECHNIQUES_UP_{d:techniques_byte} = \3
|
|
|
|
shift
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
elif !STRCMP("\1", "DOWN")
|
|
|
|
DEF _NEXT_SPACE_DOWN = \2
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF _TECHNIQUES_DOWN = TRUE
|
|
|
|
rept _NARG - 2
|
|
|
|
DEF _TECHNIQUES_DOWN_{d:techniques_byte} = \3
|
|
|
|
shift
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
endc
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
MACRO endbranch
|
|
|
|
if DEF(_NEXT_SPACE_RIGHT)
|
|
|
|
db {_NEXT_SPACE_RIGHT}
|
|
|
|
PURGE _NEXT_SPACE_RIGHT
|
|
|
|
else
|
|
|
|
db -1
|
|
|
|
endc
|
|
|
|
if DEF(_NEXT_SPACE_LEFT)
|
|
|
|
db {_NEXT_SPACE_LEFT}
|
|
|
|
PURGE _NEXT_SPACE_LEFT
|
|
|
|
else
|
|
|
|
db -1
|
|
|
|
endc
|
|
|
|
if DEF(_NEXT_SPACE_UP)
|
|
|
|
db {_NEXT_SPACE_UP}
|
|
|
|
PURGE _NEXT_SPACE_UP
|
|
|
|
else
|
|
|
|
db -1
|
|
|
|
endc
|
|
|
|
if DEF(_NEXT_SPACE_DOWN)
|
|
|
|
db {_NEXT_SPACE_DOWN}
|
|
|
|
PURGE _NEXT_SPACE_DOWN
|
|
|
|
else
|
|
|
|
db -1
|
|
|
|
endc
|
|
|
|
if DEF(_TECHNIQUES_RIGHT)
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF techniques_byte = 0
|
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db {_TECHNIQUES_RIGHT_{d:techniques_byte}}
|
|
|
|
PURGE _TECHNIQUES_RIGHT_{d:techniques_byte}
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
PURGE _TECHNIQUES_RIGHT
|
|
|
|
else
|
2024-02-19 08:10:33 -08:00
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db 0
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
endc
|
|
|
|
if DEF(_TECHNIQUES_LEFT)
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF techniques_byte = 0
|
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db {_TECHNIQUES_LEFT_{d:techniques_byte}}
|
|
|
|
PURGE _TECHNIQUES_LEFT_{d:techniques_byte}
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
PURGE _TECHNIQUES_LEFT
|
|
|
|
else
|
2024-02-19 08:10:33 -08:00
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db 0
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
endc
|
|
|
|
if DEF(_TECHNIQUES_UP)
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF techniques_byte = 0
|
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db {_TECHNIQUES_UP_{d:techniques_byte}}
|
|
|
|
PURGE _TECHNIQUES_UP_{d:techniques_byte}
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
PURGE _TECHNIQUES_UP
|
|
|
|
else
|
2024-02-19 08:10:33 -08:00
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db 0
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
endc
|
|
|
|
if DEF(_TECHNIQUES_DOWN)
|
2024-02-19 08:10:33 -08:00
|
|
|
DEF techniques_byte = 0
|
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db {_TECHNIQUES_DOWN_{d:techniques_byte}}
|
|
|
|
PURGE _TECHNIQUES_DOWN_{d:techniques_byte}
|
|
|
|
DEF techniques_byte += 1
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
PURGE _TECHNIQUES_DOWN
|
|
|
|
else
|
2024-02-19 08:10:33 -08:00
|
|
|
rept (NUM_TECHNIQUES + 7) / 8
|
|
|
|
db 0
|
|
|
|
endr
|
2023-10-28 11:57:59 -07:00
|
|
|
endc
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO trainer
|
2018-01-23 10:08:48 -08:00
|
|
|
;\1: trainer group
|
|
|
|
;\2: trainer id
|
2023-11-28 04:59:36 -08:00
|
|
|
;\3: flag: an EVENT_* constant
|
2017-12-13 21:36:24 -08:00
|
|
|
;\4: seen text
|
|
|
|
;\5: win text
|
|
|
|
;\6: loss text
|
|
|
|
;\7: after-battle text
|
2018-01-23 10:08:48 -08:00
|
|
|
dw \3
|
|
|
|
db \1, \2
|
2017-12-13 21:36:24 -08:00
|
|
|
dw \4, \5, \6, \7
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2023-11-28 04:59:36 -08:00
|
|
|
MACRO talker
|
|
|
|
;\1: flag: an EVENT_* constant
|
|
|
|
;\2: OPTIONAL or MANDATORY
|
2023-11-28 12:36:51 -08:00
|
|
|
;\3: talker type: TEXT, SCRIPT
|
|
|
|
;\4: pointer to talker text or script
|
2023-11-28 04:59:36 -08:00
|
|
|
dw \1
|
2023-11-28 12:36:51 -08:00
|
|
|
db TALKEREVENTTYPE_\2 | TALKERTYPE_\3
|
2023-11-28 04:59:36 -08:00
|
|
|
dw \4
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO itemball
|
2017-12-13 21:36:24 -08:00
|
|
|
;\1: item: from constants/item_constants.asm
|
|
|
|
;\2: quantity: default 1
|
2022-06-06 14:25:42 -07:00
|
|
|
if _NARG == 1
|
|
|
|
itemball \1, 1
|
|
|
|
else
|
|
|
|
db \1, \2
|
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-13 21:36:24 -08:00
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO hiddenitem
|
2018-01-23 09:59:21 -08:00
|
|
|
;\1: item: from constants/item_constants.asm
|
|
|
|
;\2: flag: an EVENT_* constant
|
|
|
|
dwb \2, \1
|
2018-01-12 21:47:38 -08:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO elevfloor
|
2017-12-13 21:36:24 -08:00
|
|
|
;\1: floor: a FLOOR_* constant
|
|
|
|
;\2: warp destination: starts at 1
|
|
|
|
;\3: map id
|
|
|
|
db \1, \2
|
2018-02-03 13:58:49 -08:00
|
|
|
map_id \3
|
2017-12-13 21:36:24 -08:00
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO conditional_event
|
2018-01-12 21:47:38 -08:00
|
|
|
;\1: flag: an EVENT_* constant
|
|
|
|
;\2: script pointer
|
|
|
|
dw \1, \2
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO cmdqueue
|
2018-01-12 21:47:38 -08:00
|
|
|
;\1: type: a CMDQUEUE_* constant
|
|
|
|
;\2: data pointer
|
|
|
|
dbw \1, \2
|
|
|
|
dw 0 ; filler
|
|
|
|
ENDM
|
|
|
|
|
2022-06-06 14:25:42 -07:00
|
|
|
MACRO stonetable
|
2017-12-13 21:36:24 -08:00
|
|
|
;\1: warp id
|
2017-12-24 10:46:34 -08:00
|
|
|
;\2: object_event id
|
2017-12-13 21:36:24 -08:00
|
|
|
;\3: script pointer
|
2021-05-30 12:51:49 -07:00
|
|
|
db \1, \2
|
|
|
|
dw \3
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|