RGBDS syntax updates (#905)

New MACRO and DEF syntax
This commit is contained in:
vulcandth
2022-06-06 16:25:42 -05:00
committed by GitHub
parent a4d346cc8c
commit 3648afda16
179 changed files with 2546 additions and 2545 deletions

View File

@@ -1,30 +1,30 @@
channel_count: MACRO
MACRO channel_count
assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \
"channel_count must be 1-{d:NUM_MUSIC_CHANS}"
_num_channels = \1 - 1
DEF _num_channels = \1 - 1
ENDM
channel: MACRO
MACRO channel
assert 0 < (\1) && (\1) <= NUM_CHANNELS, \
"channel id must be 1-{d:NUM_CHANNELS}"
dn (_num_channels << 2), \1 - 1 ; channel id
dw \2 ; address
_num_channels = 0
DEF _num_channels = 0
ENDM
note: MACRO
MACRO note
dn (\1), (\2) - 1 ; pitch, length
ENDM
drum_note: MACRO
MACRO drum_note
note \1, \2 ; drum instrument, length
ENDM
rest: MACRO
MACRO rest
note 0, \1 ; length
ENDM
square_note: MACRO
MACRO square_note
db \1 ; length
if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
@@ -34,7 +34,7 @@ square_note: MACRO
dw \4 ; frequency
ENDM
noise_note: MACRO
MACRO noise_note
db \1 ; length
if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
@@ -46,10 +46,10 @@ ENDM
; MusicCommands indexes (see audio/engine.asm)
const_def $d0
FIRST_MUSIC_CMD EQU const_value
DEF FIRST_MUSIC_CMD EQU const_value
const octave_cmd ; $d0
octave: MACRO
MACRO octave
assert 1 <= (\1) && (\1) <= 8, "octave must be 1-8"
db octave_cmd + 8 - (\1) ; octave
ENDM
@@ -57,7 +57,7 @@ ENDM
const_skip 7 ; all octave values
const note_type_cmd ; $d8
note_type: MACRO
MACRO note_type
db note_type_cmd
db \1 ; note length
if _NARG >= 2
@@ -70,30 +70,30 @@ note_type: MACRO
ENDM
; only valid on the noise channel
drum_speed: MACRO
MACRO drum_speed
note_type \1 ; note length
ENDM
const transpose_cmd ; $d9
transpose: MACRO
MACRO transpose
db transpose_cmd
dn \1, \2 ; num octaves, num pitches
ENDM
const tempo_cmd ; $da
tempo: MACRO
MACRO tempo
db tempo_cmd
bigdw \1 ; tempo
ENDM
const duty_cycle_cmd ; $db
duty_cycle: MACRO
MACRO duty_cycle
db duty_cycle_cmd
db \1 ; duty cycle
ENDM
const volume_envelope_cmd ; $dc
volume_envelope: MACRO
MACRO volume_envelope
db volume_envelope_cmd
if \2 < 0
dn \1, %1000 | (\2 * -1) ; volume envelope
@@ -103,7 +103,7 @@ volume_envelope: MACRO
ENDM
const pitch_sweep_cmd ; $dd
pitch_sweep: MACRO
MACRO pitch_sweep
db pitch_sweep_cmd
if \2 < 0
dn \1, %1000 | (\2 * -1) ; pitch sweep
@@ -113,25 +113,25 @@ pitch_sweep: MACRO
ENDM
const duty_cycle_pattern_cmd ; $de
duty_cycle_pattern: MACRO
MACRO duty_cycle_pattern
db duty_cycle_pattern_cmd
db (\1 << 6) | (\2 << 4) | (\3 << 2) | (\4 << 0) ; duty cycle pattern
ENDM
const toggle_sfx_cmd ; $df
toggle_sfx: MACRO
MACRO toggle_sfx
db toggle_sfx_cmd
ENDM
const pitch_slide_cmd ; $e0
pitch_slide: MACRO
MACRO pitch_slide
db pitch_slide_cmd
db \1 - 1 ; duration
dn 8 - \2, \3 % 12 ; octave, pitch
ENDM
const vibrato_cmd ; $e1
vibrato: MACRO
MACRO vibrato
db vibrato_cmd
db \1 ; delay
if _NARG > 2
@@ -142,13 +142,13 @@ vibrato: MACRO
ENDM
const unknownmusic0xe2_cmd ; $e2
unknownmusic0xe2: MACRO
MACRO unknownmusic0xe2
db unknownmusic0xe2_cmd
db \1 ; unknown
ENDM
const toggle_noise_cmd ; $e3
toggle_noise: MACRO
MACRO toggle_noise
db toggle_noise_cmd
if _NARG > 0
db \1 ; drum kit
@@ -156,13 +156,13 @@ toggle_noise: MACRO
ENDM
const force_stereo_panning_cmd ; $e4
force_stereo_panning: MACRO
MACRO force_stereo_panning
db force_stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
const volume_cmd ; $e5
volume: MACRO
MACRO volume
db volume_cmd
if _NARG > 1
dn \1, \2 ; left volume, right volume
@@ -172,65 +172,65 @@ volume: MACRO
ENDM
const pitch_offset_cmd ; $e6
pitch_offset: MACRO
MACRO pitch_offset
db pitch_offset_cmd
bigdw \1 ; pitch offset
ENDM
const unknownmusic0xe7_cmd ; $e7
unknownmusic0xe7: MACRO
MACRO unknownmusic0xe7
db unknownmusic0xe7_cmd
db \1 ; unknown
ENDM
const unknownmusic0xe8_cmd ; $e8
unknownmusic0xe8: MACRO
MACRO unknownmusic0xe8
db unknownmusic0xe8_cmd
db \1 ; unknown
ENDM
const tempo_relative_cmd ; $e9
tempo_relative: MACRO
MACRO tempo_relative
db tempo_relative_cmd
bigdw \1 ; tempo adjustment
ENDM
const restart_channel_cmd ; $ea
restart_channel: MACRO
MACRO restart_channel
db restart_channel_cmd
dw \1 ; address
ENDM
const new_song_cmd ; $eb
new_song: MACRO
MACRO new_song
db new_song_cmd
bigdw \1 ; id
ENDM
const sfx_priority_on_cmd ; $ec
sfx_priority_on: MACRO
MACRO sfx_priority_on
db sfx_priority_on_cmd
ENDM
const sfx_priority_off_cmd ; $ed
sfx_priority_off: MACRO
MACRO sfx_priority_off
db sfx_priority_off_cmd
ENDM
const unknownmusic0xee_cmd ; $ee
unknownmusic0xee: MACRO
MACRO unknownmusic0xee
db unknownmusic0xee_cmd
dw \1 ; address
ENDM
const stereo_panning_cmd ; $ef
stereo_panning: MACRO
MACRO stereo_panning
db stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
const sfx_toggle_noise_cmd ; $f0
sfx_toggle_noise: MACRO
MACRO sfx_toggle_noise
db sfx_toggle_noise_cmd
if _NARG > 0
db \1 ; drum kit
@@ -238,83 +238,83 @@ sfx_toggle_noise: MACRO
ENDM
const music0xf1_cmd ; $f1
music0xf1: MACRO
MACRO music0xf1
db music0xf1_cmd
ENDM
const music0xf2_cmd ; $f2
music0xf2: MACRO
MACRO music0xf2
db music0xf2_cmd
ENDM
const music0xf3_cmd ; $f3
music0xf3: MACRO
MACRO music0xf3
db music0xf3_cmd
ENDM
const music0xf4_cmd ; $f4
music0xf4: MACRO
MACRO music0xf4
db music0xf4_cmd
ENDM
const music0xf5_cmd ; $f5
music0xf5: MACRO
MACRO music0xf5
db music0xf5_cmd
ENDM
const music0xf6_cmd ; $f6
music0xf6: MACRO
MACRO music0xf6
db music0xf6_cmd
ENDM
const music0xf7_cmd ; $f7
music0xf7: MACRO
MACRO music0xf7
db music0xf7_cmd
ENDM
const music0xf8_cmd ; $f8
music0xf8: MACRO
MACRO music0xf8
db music0xf8_cmd
ENDM
const unknownmusic0xf9_cmd ; $f9
unknownmusic0xf9: MACRO
MACRO unknownmusic0xf9
db unknownmusic0xf9_cmd
ENDM
const set_condition_cmd ; $fa
set_condition: MACRO
MACRO set_condition
db set_condition_cmd
db \1 ; condition
ENDM
const sound_jump_if_cmd ; $fb
sound_jump_if: MACRO
MACRO sound_jump_if
db sound_jump_if_cmd
db \1 ; condition
dw \2 ; address
ENDM
const sound_jump_cmd ; $fc
sound_jump: MACRO
MACRO sound_jump
db sound_jump_cmd
dw \1 ; address
ENDM
const sound_loop_cmd ; $fd
sound_loop: MACRO
MACRO sound_loop
db sound_loop_cmd
db \1 ; count
dw \2 ; address
ENDM
const sound_call_cmd ; $fe
sound_call: MACRO
MACRO sound_call
db sound_call_cmd
dw \1 ; address
ENDM
const sound_ret_cmd ; $ff
sound_ret: MACRO
MACRO sound_ret
db sound_ret_cmd
ENDM

View File

@@ -1,44 +1,44 @@
; BattleAnimCommands indexes (see engine/battle_anims/anim_commands.asm)
const_def $d0
FIRST_BATTLE_ANIM_CMD EQU const_value
DEF FIRST_BATTLE_ANIM_CMD EQU const_value
anim_wait: MACRO
MACRO anim_wait
assert (\1) < FIRST_BATTLE_ANIM_CMD, "anim_wait argument must be less than {FIRST_BATTLE_ANIM_CMD}"
db \1
ENDM
const anim_obj_command ; $d0
anim_obj: MACRO
MACRO anim_obj
db anim_obj_command
if _NARG <= 4
db \1 ; object
db \2 ; x
db \3 ; y
db \4 ; param
else
; LEGACY: Support the tile+offset format
db \1 ; object
db (\2) * 8 + (\3) ; x_tile, x
db (\4) * 8 + (\5) ; y_tile, y
db \6 ; param
endc
if _NARG <= 4
db \1 ; object
db \2 ; x
db \3 ; y
db \4 ; param
else
; LEGACY: Support the tile+offset format
db \1 ; object
db (\2) * 8 + (\3) ; x_tile, x
db (\4) * 8 + (\5) ; y_tile, y
db \6 ; param
endc
ENDM
const anim_1gfx_command ; $d1
anim_1gfx: MACRO
MACRO anim_1gfx
db anim_1gfx_command
db \1 ; gfx1
ENDM
const anim_2gfx_command ; $d2
anim_2gfx: MACRO
MACRO anim_2gfx
db anim_2gfx_command
db \1 ; gfx1
db \2 ; gfx2
ENDM
const anim_3gfx_command ; $d3
anim_3gfx: MACRO
MACRO anim_3gfx
db anim_3gfx_command
db \1 ; gfx1
db \2 ; gfx2
@@ -46,7 +46,7 @@ anim_3gfx: MACRO
ENDM
const anim_4gfx_command ; $d4
anim_4gfx: MACRO
MACRO anim_4gfx
db anim_4gfx_command
db \1 ; gfx1
db \2 ; gfx2
@@ -55,7 +55,7 @@ anim_4gfx: MACRO
ENDM
const anim_5gfx_command ; $d5
anim_5gfx: MACRO
MACRO anim_5gfx
db anim_5gfx_command
db \1 ; gfx1
db \2 ; gfx2
@@ -65,147 +65,147 @@ anim_5gfx: MACRO
ENDM
const anim_incobj_command ; $d6
anim_incobj: MACRO
MACRO anim_incobj
db anim_incobj_command
db \1 ; object_id
ENDM
const anim_setobj_command ; $d7
anim_setobj: MACRO
MACRO anim_setobj
db anim_setobj_command
db \1 ; object_id
db \2 ; value
ENDM
const anim_incbgeffect_command ; $d8
anim_incbgeffect: MACRO
MACRO anim_incbgeffect
db anim_incbgeffect_command
db \1 ; effect
ENDM
const anim_battlergfx_2row_command ; $d9
anim_battlergfx_2row: MACRO
MACRO anim_battlergfx_2row
db anim_battlergfx_2row_command
ENDM
const anim_battlergfx_1row_command ; $da
anim_battlergfx_1row: MACRO
MACRO anim_battlergfx_1row
db anim_battlergfx_1row_command
ENDM
const anim_checkpokeball_command ; $db
anim_checkpokeball: MACRO
MACRO anim_checkpokeball
db anim_checkpokeball_command
ENDM
const anim_transform_command ; $dc
anim_transform: MACRO
MACRO anim_transform
db anim_transform_command
ENDM
const anim_raisesub_command ; $dd
anim_raisesub: MACRO
MACRO anim_raisesub
db anim_raisesub_command
ENDM
const anim_dropsub_command ; $de
anim_dropsub: MACRO
MACRO anim_dropsub
db anim_dropsub_command
ENDM
const anim_resetobp0_command ; $df
anim_resetobp0: MACRO
MACRO anim_resetobp0
db anim_resetobp0_command
ENDM
const anim_sound_command ; $e0
anim_sound: MACRO
MACRO anim_sound
db anim_sound_command
db (\1 << 2) | \2 ; duration, tracks
db \3 ; sound_id
ENDM
const anim_cry_command ; $e1
anim_cry: MACRO
MACRO anim_cry
db anim_cry_command
db \1 ; pitch
ENDM
const anim_minimizeopp_command ; $e2
anim_minimizeopp: MACRO
MACRO anim_minimizeopp
db anim_minimizeopp_command
ENDM
const anim_oamon_command ; $e3
anim_oamon: MACRO
MACRO anim_oamon
db anim_oamon_command
ENDM
const anim_oamoff_command ; $e4
anim_oamoff: MACRO
MACRO anim_oamoff
db anim_oamoff_command
ENDM
const anim_clearobjs_command ; $e5
anim_clearobjs: MACRO
MACRO anim_clearobjs
db anim_clearobjs_command
ENDM
const anim_beatup_command ; $e6
anim_beatup: MACRO
MACRO anim_beatup
db anim_beatup_command
ENDM
const anim_0xe7_command ; $e7
anim_0xe7: MACRO
MACRO anim_0xe7
db anim_0xe7_command
ENDM
const anim_updateactorpic_command ; $e8
anim_updateactorpic: MACRO
MACRO anim_updateactorpic
db anim_updateactorpic_command
ENDM
const anim_minimize_command ; $e9
anim_minimize: MACRO
MACRO anim_minimize
db anim_minimize_command
ENDM
const anim_0xea_command ; $ea
anim_0xea: MACRO
MACRO anim_0xea
db anim_0xea_command
ENDM
const anim_0xeb_command ; $eb
anim_0xeb: MACRO
MACRO anim_0xeb
db anim_0xeb_command
ENDM
const anim_0xec_command ; $ec
anim_0xec: MACRO
MACRO anim_0xec
db anim_0xec_command
ENDM
const anim_0xed_command ; $ed
anim_0xed: MACRO
MACRO anim_0xed
db anim_0xed_command
ENDM
const anim_if_param_and_command ; $ee
anim_if_param_and: MACRO
MACRO anim_if_param_and
db anim_if_param_and_command
db \1 ; value
dw \2 ; address
ENDM
const anim_jumpuntil_command ; $ef
anim_jumpuntil: MACRO
MACRO anim_jumpuntil
db anim_jumpuntil_command
dw \1 ; address
ENDM
const anim_bgeffect_command ; $f0
anim_bgeffect: MACRO
MACRO anim_bgeffect
db anim_bgeffect_command
db \1 ; effect
db \2 ; jumptable index
@@ -214,88 +214,88 @@ anim_bgeffect: MACRO
ENDM
const anim_bgp_command ; $f1
anim_bgp: MACRO
MACRO anim_bgp
db anim_bgp_command
db \1 ; colors
ENDM
const anim_obp0_command ; $f2
anim_obp0: MACRO
MACRO anim_obp0
db anim_obp0_command
db \1 ; colors
ENDM
const anim_obp1_command ; $f3
anim_obp1: MACRO
MACRO anim_obp1
db anim_obp1_command
db \1 ; colors
ENDM
const anim_keepsprites_command ; $f4
anim_keepsprites: MACRO
MACRO anim_keepsprites
db anim_keepsprites_command
ENDM
const anim_0xf5_command ; $f5
anim_0xf5: MACRO
MACRO anim_0xf5
db anim_0xf5_command
ENDM
const anim_0xf6_command ; $f6
anim_0xf6: MACRO
MACRO anim_0xf6
db anim_0xf6_command
ENDM
const anim_0xf7_command ; $f7
anim_0xf7: MACRO
MACRO anim_0xf7
db anim_0xf7_command
ENDM
const anim_if_param_equal_command ; $f8
anim_if_param_equal: MACRO
MACRO anim_if_param_equal
db anim_if_param_equal_command
db \1 ; value
dw \2 ; address
ENDM
const anim_setvar_command ; $f9
anim_setvar: MACRO
MACRO anim_setvar
db anim_setvar_command
db \1 ; value
ENDM
const anim_incvar_command ; $fa
anim_incvar: MACRO
MACRO anim_incvar
db anim_incvar_command
ENDM
const anim_if_var_equal_command ; $fb
anim_if_var_equal: MACRO
MACRO anim_if_var_equal
db anim_if_var_equal_command
db \1 ; value
dw \2 ; address
ENDM
const anim_jump_command ; $fc
anim_jump: MACRO
MACRO anim_jump
db anim_jump_command
dw \1 ; address
ENDM
const anim_loop_command ; $fd
anim_loop: MACRO
MACRO anim_loop
db anim_loop_command
db \1 ; count
dw \2 ; address
ENDM
const anim_call_command ; $fe
anim_call: MACRO
MACRO anim_call
db anim_call_command
dw \1 ; address
ENDM
const anim_ret_command ; $ff
anim_ret: MACRO
MACRO anim_ret
db anim_ret_command
ENDM

View File

@@ -1,6 +1,6 @@
command: MACRO
MACRO command
const \1_command
\1 EQUS "db \1_command"
DEF \1 EQUS "db \1_command"
ENDM
; BattleCommandPointers indexes (see data/battle/effect_command_pointers.asm)
@@ -180,7 +180,7 @@ ENDM
command supereffectivelooptext ; ad
command startloop ; ae
command curl ; af
NUM_EFFECT_COMMANDS EQU const_value - 1
DEF NUM_EFFECT_COMMANDS EQU const_value - 1
const_def -1, -1
command endmove ; ff

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +1,37 @@
; pic + oam animations
frame: MACRO
MACRO frame
db \1
x = \2
if _NARG > 2
rept _NARG - 2
x |= 1 << (\3 + 1)
shift
endr
endc
DEF x = \2
if _NARG > 2
rept _NARG - 2
DEF x |= 1 << (\3 + 1)
shift
endr
endc
db x
ENDM
const_def -1, -1
const endanim_command ; $ff
endanim: MACRO
MACRO endanim
db endanim_command
ENDM
const dorestart_command ; $fe
dorestart: MACRO
MACRO dorestart
db dorestart_command
ENDM
const dowait_command ; $fd
dowait: MACRO
MACRO dowait
db dowait_command
db \1 ; frames
ENDM
const delanim_command ; $fc
delanim: MACRO
MACRO delanim
; Removes the object from the screen, as opposed to `endanim` which just stops all motion
db delanim_command
ENDM
@@ -41,13 +41,13 @@ ENDM
const_def -2, -1
const setrepeat_command ; $fe
setrepeat: MACRO
MACRO setrepeat
db setrepeat_command
db \1 ; amount of times to repeat
ENDM
const dorepeat_command ; $fd
dorepeat: MACRO
MACRO dorepeat
db dorepeat_command
db \1 ; command offset to jump to
ENDM

View File

@@ -1,61 +1,61 @@
map_id: MACRO
MACRO map_id
;\1: map id
assert DEF(GROUP_\1) && DEF(MAP_\1), \
"Missing 'map_const \1' in constants/map_constants.asm"
db GROUP_\1, MAP_\1
ENDM
object_const_def EQUS "const_def 2"
DEF object_const_def EQUS "const_def 2"
def_scene_scripts: MACRO
REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@"
MACRO def_scene_scripts
REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@"
db {_NUM_SCENE_SCRIPTS}
{_NUM_SCENE_SCRIPTS} = 0
DEF {_NUM_SCENE_SCRIPTS} = 0
ENDM
scene_script: MACRO
MACRO scene_script
;\1: script pointer
dw \1
dw 0 ; filler
{_NUM_SCENE_SCRIPTS} += 1
DEF {_NUM_SCENE_SCRIPTS} += 1
ENDM
def_callbacks: MACRO
REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
MACRO def_callbacks
REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
db {_NUM_CALLBACKS}
{_NUM_CALLBACKS} = 0
DEF {_NUM_CALLBACKS} = 0
ENDM
callback: MACRO
MACRO callback
;\1: type: a MAPCALLBACK_* constant
;\2: script pointer
dbw \1, \2
{_NUM_CALLBACKS} += 1
DEF {_NUM_CALLBACKS} += 1
ENDM
def_warp_events: MACRO
REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@"
MACRO def_warp_events
REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@"
db {_NUM_WARP_EVENTS}
{_NUM_WARP_EVENTS} = 0
DEF {_NUM_WARP_EVENTS} = 0
ENDM
warp_event: MACRO
MACRO warp_event
;\1: x: left to right, starts at 0
;\2: y: top to bottom, starts at 0
;\3: map id: from constants/map_constants.asm
;\4: warp destination: starts at 1
db \2, \1, \4
map_id \3
{_NUM_WARP_EVENTS} += 1
DEF {_NUM_WARP_EVENTS} += 1
ENDM
def_coord_events: MACRO
REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@"
MACRO def_coord_events
REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@"
db {_NUM_COORD_EVENTS}
{_NUM_COORD_EVENTS} = 0
DEF {_NUM_COORD_EVENTS} = 0
ENDM
coord_event: MACRO
MACRO coord_event
;\1: x: left to right, starts at 0
;\2: y: top to bottom, starts at 0
;\3: scene id: a SCENE_* constant; controlled by setscene/setmapscene
@@ -64,32 +64,32 @@ coord_event: MACRO
db 0 ; filler
dw \4
dw 0 ; filler
{_NUM_COORD_EVENTS} += 1
DEF {_NUM_COORD_EVENTS} += 1
ENDM
def_bg_events: MACRO
REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@"
MACRO def_bg_events
REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@"
db {_NUM_BG_EVENTS}
{_NUM_BG_EVENTS} = 0
DEF {_NUM_BG_EVENTS} = 0
ENDM
bg_event: MACRO
MACRO bg_event
;\1: x: left to right, starts at 0
;\2: y: top to bottom, starts at 0
;\3: function: a BGEVENT_* constant
;\4: script pointer
db \2, \1, \3
dw \4
{_NUM_BG_EVENTS} += 1
DEF {_NUM_BG_EVENTS} += 1
ENDM
def_object_events: MACRO
REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@"
MACRO def_object_events
REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@"
db {_NUM_OBJECT_EVENTS}
{_NUM_OBJECT_EVENTS} = 0
DEF {_NUM_OBJECT_EVENTS} = 0
ENDM
object_event: MACRO
MACRO object_event
;\1: x: left to right, starts at 0
;\2: y: top to bottom, starts at 0
;\3: sprite: a SPRITE_* constant
@@ -112,13 +112,13 @@ object_event: MACRO
dn \9, \<10>
db \<11>
dw \<12>, \<13>
; the dummy PlayerObjectTemplate object_event has no def_object_events
if DEF(_NUM_OBJECT_EVENTS)
{_NUM_OBJECT_EVENTS} += 1
endc
; the dummy PlayerObjectTemplate object_event has no def_object_events
if DEF(_NUM_OBJECT_EVENTS)
DEF {_NUM_OBJECT_EVENTS} += 1
endc
ENDM
trainer: MACRO
MACRO trainer
;\1: trainer group
;\2: trainer id
;\3: flag: an EVENT_BEAT_* constant
@@ -131,23 +131,23 @@ trainer: MACRO
dw \4, \5, \6, \7
ENDM
itemball: MACRO
MACRO itemball
;\1: item: from constants/item_constants.asm
;\2: quantity: default 1
if _NARG == 1
itemball \1, 1
else
db \1, \2
endc
if _NARG == 1
itemball \1, 1
else
db \1, \2
endc
ENDM
hiddenitem: MACRO
MACRO hiddenitem
;\1: item: from constants/item_constants.asm
;\2: flag: an EVENT_* constant
dwb \2, \1
ENDM
elevfloor: MACRO
MACRO elevfloor
;\1: floor: a FLOOR_* constant
;\2: warp destination: starts at 1
;\3: map id
@@ -155,20 +155,20 @@ elevfloor: MACRO
map_id \3
ENDM
conditional_event: MACRO
MACRO conditional_event
;\1: flag: an EVENT_* constant
;\2: script pointer
dw \1, \2
ENDM
cmdqueue: MACRO
MACRO cmdqueue
;\1: type: a CMDQUEUE_* constant
;\2: data pointer
dbw \1, \2
dw 0 ; filler
ENDM
stonetable: MACRO
MACRO stonetable
;\1: warp id
;\2: object_event id
;\3: script pointer

View File

@@ -4,219 +4,219 @@
; Directional movements
const movement_turn_head ; $00
turn_head: MACRO
MACRO turn_head
db movement_turn_head | \1
ENDM
const movement_turn_step ; $04
turn_step: MACRO
MACRO turn_step
db movement_turn_step | \1
ENDM
const movement_slow_step ; $08
slow_step: MACRO
MACRO slow_step
db movement_slow_step | \1
ENDM
const movement_step ; $0c
step: MACRO
MACRO step
db movement_step | \1
ENDM
const movement_big_step ; $10
big_step: MACRO
MACRO big_step
db movement_big_step | \1
ENDM
const movement_slow_slide_step ; $14
slow_slide_step: MACRO
MACRO slow_slide_step
db movement_slow_slide_step | \1
ENDM
const movement_slide_step ; $18
slide_step: MACRO
MACRO slide_step
db movement_slide_step | \1
ENDM
const movement_fast_slide_step ; $1c
fast_slide_step: MACRO
MACRO fast_slide_step
db movement_fast_slide_step | \1
ENDM
const movement_turn_away ; $20
turn_away: MACRO
MACRO turn_away
db movement_turn_away | \1
ENDM
const movement_turn_in ; $24
turn_in: MACRO
MACRO turn_in
db movement_turn_in | \1
ENDM
const movement_turn_waterfall ; $28
turn_waterfall: MACRO
MACRO turn_waterfall
db movement_turn_waterfall | \1
ENDM
const movement_slow_jump_step ; $2c
slow_jump_step: MACRO
MACRO slow_jump_step
db movement_slow_jump_step | \1
ENDM
const movement_jump_step ; $30
jump_step: MACRO
MACRO jump_step
db movement_jump_step | \1
ENDM
const movement_fast_jump_step ; $34
fast_jump_step: MACRO
MACRO fast_jump_step
db movement_fast_jump_step | \1
ENDM
const_inc = 1
DEF const_inc = 1
; Control
const movement_remove_sliding ; $38
remove_sliding: MACRO
MACRO remove_sliding
db movement_remove_sliding
ENDM
const movement_set_sliding ; $39
set_sliding: MACRO
MACRO set_sliding
db movement_set_sliding
ENDM
const movement_remove_fixed_facing ; $3a
remove_fixed_facing: MACRO
MACRO remove_fixed_facing
db movement_remove_fixed_facing
ENDM
const movement_fix_facing ; $3b
fix_facing: MACRO
MACRO fix_facing
db movement_fix_facing
ENDM
const movement_show_object ; $3c
show_object: MACRO
MACRO show_object
db movement_show_object
ENDM
const movement_hide_object ; $3d
hide_object: MACRO
MACRO hide_object
db movement_hide_object
ENDM
; Sleep
const movement_step_sleep ; $3e
step_sleep: MACRO
if \1 <= 8
db movement_step_sleep + \1 - 1
else
db movement_step_sleep + 8, \1
endc
MACRO step_sleep
if \1 <= 8
db movement_step_sleep + \1 - 1
else
db movement_step_sleep + 8, \1
endc
ENDM
const_skip 8 ; all step_sleep values
const movement_step_end ; $47
step_end: MACRO
MACRO step_end
db movement_step_end
ENDM
const movement_step_48 ; $48
step_48: MACRO
MACRO step_48
db movement_step_48
db \1 ; ???
ENDM
const movement_remove_object ; $49
remove_object: MACRO
MACRO remove_object
db movement_remove_object
ENDM
const movement_step_loop ; $4a
step_loop: MACRO
MACRO step_loop
db movement_step_loop
ENDM
const movement_step_4b ; $4b
step_4b: MACRO
MACRO step_4b
db movement_step_4b
ENDM
const movement_teleport_from ; $4c
teleport_from: MACRO
MACRO teleport_from
db movement_teleport_from
ENDM
const movement_teleport_to ; $4d
teleport_to: MACRO
MACRO teleport_to
db movement_teleport_to
ENDM
const movement_skyfall ; $4e
skyfall: MACRO
MACRO skyfall
db movement_skyfall
ENDM
const movement_step_dig ; $4f
step_dig: MACRO
MACRO step_dig
db movement_step_dig
db \1 ; length
ENDM
const movement_step_bump ; $50
step_bump: MACRO
MACRO step_bump
db movement_step_bump
ENDM
const movement_fish_got_bite ; $51
fish_got_bite: MACRO
MACRO fish_got_bite
db movement_fish_got_bite
ENDM
const movement_fish_cast_rod ; $52
fish_cast_rod: MACRO
MACRO fish_cast_rod
db movement_fish_cast_rod
ENDM
const movement_hide_emote ; $53
hide_emote: MACRO
MACRO hide_emote
db movement_hide_emote
ENDM
const movement_show_emote ; $54
show_emote: MACRO
MACRO show_emote
db movement_show_emote
ENDM
const movement_step_shake ; $55
step_shake: MACRO
MACRO step_shake
db movement_step_shake
db \1 ; displacement
ENDM
const movement_tree_shake ; $56
tree_shake: MACRO
MACRO tree_shake
db movement_tree_shake
ENDM
const movement_rock_smash ; $57
rock_smash: MACRO
MACRO rock_smash
db movement_rock_smash
db \1 ; length
ENDM
const movement_return_dig ; $58
return_dig: MACRO
MACRO return_dig
db movement_return_dig
db \1 ; length
ENDM
const movement_skyfall_top ; $59
skyfall_top: MACRO
MACRO skyfall_top
db movement_skyfall_top
ENDM
NUM_MOVEMENT_CMDS EQU const_value
DEF NUM_MOVEMENT_CMDS EQU const_value

View File

@@ -1,147 +1,147 @@
text EQUS "db TX_START," ; Start writing text.
next EQUS "db \"<NEXT>\"," ; Move a line down.
line EQUS "db \"<LINE>\"," ; Start writing at the bottom line.
page EQUS "db \"@\"," ; Start a new Pokédex page.
para EQUS "db \"<PARA>\"," ; Start a new paragraph.
cont EQUS "db \"<CONT>\"," ; Scroll to the next line.
done EQUS "db \"<DONE>\"" ; End a text box.
prompt EQUS "db \"<PROMPT>\"" ; Prompt the player to end a text box (initiating some other event).
DEF text EQUS "db TX_START," ; Start writing text.
DEF next EQUS "db \"<NEXT>\"," ; Move a line down.
DEF line EQUS "db \"<LINE>\"," ; Start writing at the bottom line.
DEF page EQUS "db \"@\"," ; Start a new Pokédex page.
DEF para EQUS "db \"<PARA>\"," ; Start a new paragraph.
DEF cont EQUS "db \"<CONT>\"," ; Scroll to the next line.
DEF done EQUS "db \"<DONE>\"" ; End a text box.
DEF prompt EQUS "db \"<PROMPT>\"" ; Prompt the player to end a text box (initiating some other event).
; TextCommands indexes (see home/text.asm)
const_def
const TX_START ; $00
text_start: MACRO
MACRO text_start
db TX_START
ENDM
const TX_RAM ; $01
text_ram: MACRO
MACRO text_ram
db TX_RAM
dw \1
ENDM
const TX_BCD ; $02
text_bcd: MACRO
MACRO text_bcd
db TX_BCD
dw \1
db \2
ENDM
const TX_MOVE ; $03
text_move: MACRO
MACRO text_move
db TX_MOVE
dw \1
ENDM
const TX_BOX ; $04
text_box: MACRO
MACRO text_box
db TX_BOX
dw \1
db \2, \3
ENDM
const TX_LOW ; $05
text_low: MACRO
MACRO text_low
db TX_LOW
ENDM
const TX_PROMPT_BUTTON ; $06
text_promptbutton: MACRO
MACRO text_promptbutton
db TX_PROMPT_BUTTON
ENDM
const TX_SCROLL ; $07
text_scroll: MACRO
MACRO text_scroll
db TX_SCROLL
ENDM
const TX_START_ASM ; $08
text_asm: MACRO
MACRO text_asm
db TX_START_ASM
ENDM
const TX_DECIMAL ; $09
text_decimal: MACRO
MACRO text_decimal
db TX_DECIMAL
dw \1 ; address
dn \2, \3 ; bytes, digits
ENDM
const TX_PAUSE ; $0a
text_pause: MACRO
MACRO text_pause
db TX_PAUSE
ENDM
const TX_SOUND_DEX_FANFARE_50_79 ; $0b
sound_dex_fanfare_50_79: MACRO
MACRO sound_dex_fanfare_50_79
db TX_SOUND_DEX_FANFARE_50_79
ENDM
const TX_DOTS ; $0c
text_dots: MACRO
MACRO text_dots
db TX_DOTS
db \1
ENDM
const TX_WAIT_BUTTON ; $0d
text_waitbutton: MACRO
MACRO text_waitbutton
db TX_WAIT_BUTTON
ENDM
const TX_SOUND_DEX_FANFARE_20_49 ; $0e
sound_dex_fanfare_20_49: MACRO
MACRO sound_dex_fanfare_20_49
db TX_SOUND_DEX_FANFARE_20_49
ENDM
const TX_SOUND_ITEM ; $0f
sound_item: MACRO
MACRO sound_item
db TX_SOUND_ITEM
ENDM
const TX_SOUND_CAUGHT_MON ; $10
sound_caught_mon: MACRO
MACRO sound_caught_mon
db TX_SOUND_CAUGHT_MON
ENDM
const TX_SOUND_DEX_FANFARE_80_109 ; $11
sound_dex_fanfare_80_109: MACRO
MACRO sound_dex_fanfare_80_109
db TX_SOUND_DEX_FANFARE_80_109
ENDM
const TX_SOUND_FANFARE ; $12
sound_fanfare: MACRO
MACRO sound_fanfare
db TX_SOUND_FANFARE
ENDM
const TX_SOUND_SLOT_MACHINE_START ; $13
sound_slot_machine_start: MACRO
MACRO sound_slot_machine_start
db TX_SOUND_SLOT_MACHINE_START
ENDM
const TX_STRINGBUFFER ; $14
text_buffer: MACRO
MACRO text_buffer
db TX_STRINGBUFFER
db \1
ENDM
const TX_DAY ; $15
text_today: MACRO
MACRO text_today
db TX_DAY
ENDM
const TX_FAR ; $16
text_far: MACRO
MACRO text_far
db TX_FAR
dw \1
db BANK(\1)
ENDM
NUM_TEXT_CMDS EQU const_value
DEF NUM_TEXT_CMDS EQU const_value
const_next $50
const TX_END ; $50
text_end: MACRO
MACRO text_end
db TX_END
ENDM