First Commit

Upload literally everything from the pokecrystal16 expand-move-ID branch
This commit is contained in:
Zeta_Null 2023-09-10 12:35:35 -04:00
commit 2f8a41f833
4618 changed files with 480386 additions and 0 deletions

320
macros/scripts/audio.asm Normal file
View file

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

View file

@ -0,0 +1,301 @@
; BattleAnimCommands indexes (see engine/battle_anims/anim_commands.asm)
const_def $d0
DEF FIRST_BATTLE_ANIM_CMD EQU const_value
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
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
ENDM
const anim_1gfx_command ; $d1
MACRO anim_1gfx
db anim_1gfx_command
db \1 ; gfx1
ENDM
const anim_2gfx_command ; $d2
MACRO anim_2gfx
db anim_2gfx_command
db \1 ; gfx1
db \2 ; gfx2
ENDM
const anim_3gfx_command ; $d3
MACRO anim_3gfx
db anim_3gfx_command
db \1 ; gfx1
db \2 ; gfx2
db \3 ; gfx3
ENDM
const anim_4gfx_command ; $d4
MACRO anim_4gfx
db anim_4gfx_command
db \1 ; gfx1
db \2 ; gfx2
db \3 ; gfx3
db \4 ; gfx4
ENDM
const anim_5gfx_command ; $d5
MACRO anim_5gfx
db anim_5gfx_command
db \1 ; gfx1
db \2 ; gfx2
db \3 ; gfx3
db \4 ; gfx4
db \5 ; gfx5
ENDM
const anim_incobj_command ; $d6
MACRO anim_incobj
db anim_incobj_command
db \1 ; object_id
ENDM
const anim_setobj_command ; $d7
MACRO anim_setobj
db anim_setobj_command
db \1 ; object_id
db \2 ; value
ENDM
const anim_incbgeffect_command ; $d8
MACRO anim_incbgeffect
db anim_incbgeffect_command
db \1 ; effect
ENDM
const anim_battlergfx_2row_command ; $d9
MACRO anim_battlergfx_2row
db anim_battlergfx_2row_command
ENDM
const anim_battlergfx_1row_command ; $da
MACRO anim_battlergfx_1row
db anim_battlergfx_1row_command
ENDM
const anim_checkpokeball_command ; $db
MACRO anim_checkpokeball
db anim_checkpokeball_command
ENDM
const anim_transform_command ; $dc
MACRO anim_transform
db anim_transform_command
ENDM
const anim_raisesub_command ; $dd
MACRO anim_raisesub
db anim_raisesub_command
ENDM
const anim_dropsub_command ; $de
MACRO anim_dropsub
db anim_dropsub_command
ENDM
const anim_resetobp0_command ; $df
MACRO anim_resetobp0
db anim_resetobp0_command
ENDM
const anim_sound_command ; $e0
MACRO anim_sound
db anim_sound_command
db (\1 << 2) | \2 ; duration, tracks
db \3 ; sound_id
ENDM
const anim_cry_command ; $e1
MACRO anim_cry
db anim_cry_command
db \1 ; pitch
ENDM
const anim_minimizeopp_command ; $e2
MACRO anim_minimizeopp
db anim_minimizeopp_command
ENDM
const anim_oamon_command ; $e3
MACRO anim_oamon
db anim_oamon_command
ENDM
const anim_oamoff_command ; $e4
MACRO anim_oamoff
db anim_oamoff_command
ENDM
const anim_clearobjs_command ; $e5
MACRO anim_clearobjs
db anim_clearobjs_command
ENDM
const anim_beatup_command ; $e6
MACRO anim_beatup
db anim_beatup_command
ENDM
const anim_0xe7_command ; $e7
MACRO anim_0xe7
db anim_0xe7_command
ENDM
const anim_updateactorpic_command ; $e8
MACRO anim_updateactorpic
db anim_updateactorpic_command
ENDM
const anim_minimize_command ; $e9
MACRO anim_minimize
db anim_minimize_command
ENDM
const anim_0xea_command ; $ea
MACRO anim_0xea
db anim_0xea_command
ENDM
const anim_0xeb_command ; $eb
MACRO anim_0xeb
db anim_0xeb_command
ENDM
const anim_0xec_command ; $ec
MACRO anim_0xec
db anim_0xec_command
ENDM
const anim_0xed_command ; $ed
MACRO anim_0xed
db anim_0xed_command
ENDM
const anim_if_param_and_command ; $ee
MACRO anim_if_param_and
db anim_if_param_and_command
db \1 ; value
dw \2 ; address
ENDM
const anim_jumpuntil_command ; $ef
MACRO anim_jumpuntil
db anim_jumpuntil_command
dw \1 ; address
ENDM
const anim_bgeffect_command ; $f0
MACRO anim_bgeffect
db anim_bgeffect_command
db \1 ; effect
db \2 ; jumptable index
db \3 ; battle turn
db \4 ; unknown
ENDM
const anim_bgp_command ; $f1
MACRO anim_bgp
db anim_bgp_command
db \1 ; colors
ENDM
const anim_obp0_command ; $f2
MACRO anim_obp0
db anim_obp0_command
db \1 ; colors
ENDM
const anim_obp1_command ; $f3
MACRO anim_obp1
db anim_obp1_command
db \1 ; colors
ENDM
const anim_keepsprites_command ; $f4
MACRO anim_keepsprites
db anim_keepsprites_command
ENDM
const anim_0xf5_command ; $f5
MACRO anim_0xf5
db anim_0xf5_command
ENDM
const anim_0xf6_command ; $f6
MACRO anim_0xf6
db anim_0xf6_command
ENDM
const anim_0xf7_command ; $f7
MACRO anim_0xf7
db anim_0xf7_command
ENDM
const anim_if_param_equal_command ; $f8
MACRO anim_if_param_equal
db anim_if_param_equal_command
db \1 ; value
dw \2 ; address
ENDM
const anim_setvar_command ; $f9
MACRO anim_setvar
db anim_setvar_command
db \1 ; value
ENDM
const anim_incvar_command ; $fa
MACRO anim_incvar
db anim_incvar_command
ENDM
const anim_if_var_equal_command ; $fb
MACRO anim_if_var_equal
db anim_if_var_equal_command
db \1 ; value
dw \2 ; address
ENDM
const anim_jump_command ; $fc
MACRO anim_jump
db anim_jump_command
dw \1 ; address
ENDM
const anim_loop_command ; $fd
MACRO anim_loop
db anim_loop_command
db \1 ; count
dw \2 ; address
ENDM
const anim_call_command ; $fe
MACRO anim_call
db anim_call_command
dw \1 ; address
ENDM
const anim_ret_command ; $ff
MACRO anim_ret
db anim_ret_command
ENDM

View file

@ -0,0 +1,187 @@
MACRO command
const \1_command
DEF \1 EQUS "db \1_command"
ENDM
; BattleCommandPointers indexes (see data/battle/effect_command_pointers.asm)
const_def 1
command checkturn ; 01
command checkobedience ; 02
command usedmovetext ; 03
command doturn ; 04
command critical ; 05
command damagestats ; 06
command stab ; 07
command damagevariation ; 08
command checkhit ; 09
command lowersub ; 0a
command moveanimnosub ; 0b
command raisesub ; 0c
command failuretext ; 0d
command applydamage ; 0e
command criticaltext ; 0f
command supereffectivetext ; 10
command checkfaint ; 11
command buildopponentrage ; 12
command poisontarget ; 13
command sleeptarget ; 14
command draintarget ; 15
command eatdream ; 16
command burntarget ; 17
command freezetarget ; 18
command paralyzetarget ; 19
command selfdestruct ; 1a
command mirrormove ; 1b
command statup ; 1c
command statdown ; 1d
command payday ; 1e
command conversion ; 1f
command resetstats ; 20
command storeenergy ; 21
command unleashenergy ; 22
command forceswitch ; 23
command endloop ; 24
command flinchtarget ; 25
command ohko ; 26
command recoil ; 27
command mist ; 28
command focusenergy ; 29
command confuse ; 2a
command confusetarget ; 2b
command heal ; 2c
command transform ; 2d
command screen ; 2e
command poison ; 2f
command paralyze ; 30
command substitute ; 31
command rechargenextturn ; 32
command mimic ; 33
command metronome ; 34
command leechseed ; 35
command splash ; 36
command disable ; 37
command cleartext ; 38
command charge ; 39
command checkcharge ; 3a
command traptarget ; 3b
command effect0x3c ; 3c
command rampage ; 3d
command checkrampage ; 3e
command constantdamage ; 3f
command counter ; 40
command encore ; 41
command painsplit ; 42
command snore ; 43
command conversion2 ; 44
command lockon ; 45
command sketch ; 46
command defrostopponent ; 47
command sleeptalk ; 48
command destinybond ; 49
command spite ; 4a
command falseswipe ; 4b
command healbell ; 4c
command kingsrock ; 4d
command triplekick ; 4e
command kickcounter ; 4f
command thief ; 50
command arenatrap ; 51
command nightmare ; 52
command defrost ; 53
command curse ; 54
command protect ; 55
command spikes ; 56
command foresight ; 57
command perishsong ; 58
command startsandstorm ; 59
command endure ; 5a
command checkcurl ; 5b
command rolloutpower ; 5c
command effect0x5d ; 5d
command furycutter ; 5e
command attract ; 5f
command happinesspower ; 60
command present ; 61
command damagecalc ; 62
command frustrationpower ; 63
command safeguard ; 64
command checksafeguard ; 65
command getmagnitude ; 66
command batonpass ; 67
command pursuit ; 68
command clearhazards ; 69
command healmorn ; 6a
command healday ; 6b
command healnite ; 6c
command hiddenpower ; 6d
command startrain ; 6e
command startsun ; 6f
command attackup ; 70
command defenseup ; 71
command speedup ; 72
command specialattackup ; 73
command specialdefenseup ; 74
command accuracyup ; 75
command evasionup ; 76
command attackup2 ; 77
command defenseup2 ; 78
command speedup2 ; 79
command specialattackup2 ; 7a
command specialdefenseup2 ; 7b
command accuracyup2 ; 7c
command evasionup2 ; 7d
command attackdown ; 7e
command defensedown ; 7f
command speeddown ; 80
command specialattackdown ; 81
command specialdefensedown ; 82
command accuracydown ; 83
command evasiondown ; 84
command attackdown2 ; 85
command defensedown2 ; 86
command speeddown2 ; 87
command specialattackdown2 ; 88
command specialdefensedown2 ; 89
command accuracydown2 ; 8a
command evasiondown2 ; 8b
command statupmessage ; 8c
command statdownmessage ; 8d
command statupfailtext ; 8e
command statdownfailtext ; 8f
command effectchance ; 90
command statdownanim ; 91
command statupanim ; 92
command switchturn ; 93
command fakeout ; 94
command bellydrum ; 95
command psychup ; 96
command rage ; 97
command doubleflyingdamage ; 98
command doubleundergrounddamage ; 99
command mirrorcoat ; 9a
command checkfuturesight ; 9b
command futuresight ; 9c
command doubleminimizedamage ; 9d
command skipsuncharge ; 9e
command thunderaccuracy ; 9f
command teleport ; a0
command beatup ; a1
command ragedamage ; a2
command resettypematchup ; a3
command allstatsup ; a4
command bidefailtext ; a5
command raisesubnoanim ; a6
command lowersubnoanim ; a7
command beatupfailtext ; a8
command clearmissdamage ; a9
command movedelay ; aa
command moveanim ; ab
command tristatuschance ; ac
command supereffectivelooptext ; ad
command startloop ; ae
command curl ; af
DEF NUM_EFFECT_COMMANDS EQU const_value - 1
const_def -1, -1
command endmove ; ff
command endturn ; fe

1080
macros/scripts/events.asm Normal file

File diff suppressed because it is too large Load diff

190
macros/scripts/maps.asm Normal file
View file

@ -0,0 +1,190 @@
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
DEF object_const_def EQUS "const_def 2"
MACRO def_scene_scripts
REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@"
db {_NUM_SCENE_SCRIPTS}
const_def
DEF {_NUM_SCENE_SCRIPTS} = 0
ENDM
MACRO scene_const
;\1: scene id constant
const \1
EXPORT \1
ENDM
MACRO scene_script
;\1: script pointer
;\2: scene id constant
dw \1
dw 0 ; filler
if _NARG == 2
scene_const \2
else
const_skip
endc
DEF {_NUM_SCENE_SCRIPTS} += 1
ENDM
MACRO def_callbacks
REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@"
db {_NUM_CALLBACKS}
DEF {_NUM_CALLBACKS} = 0
ENDM
MACRO callback
;\1: type: a MAPCALLBACK_* constant
;\2: script pointer
dbw \1, \2
DEF {_NUM_CALLBACKS} += 1
ENDM
MACRO def_warp_events
REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@"
db {_NUM_WARP_EVENTS}
DEF {_NUM_WARP_EVENTS} = 0
ENDM
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
DEF {_NUM_WARP_EVENTS} += 1
ENDM
MACRO def_coord_events
REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@"
db {_NUM_COORD_EVENTS}
DEF {_NUM_COORD_EVENTS} = 0
ENDM
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
;\4: script pointer
db \3, \2, \1
db 0 ; filler
dw \4
dw 0 ; filler
DEF {_NUM_COORD_EVENTS} += 1
ENDM
MACRO def_bg_events
REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@"
db {_NUM_BG_EVENTS}
DEF {_NUM_BG_EVENTS} = 0
ENDM
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
DEF {_NUM_BG_EVENTS} += 1
ENDM
MACRO def_object_events
REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@"
db {_NUM_OBJECT_EVENTS}
DEF {_NUM_OBJECT_EVENTS} = 0
ENDM
MACRO object_event
;\1: x: left to right, starts at 0
;\2: y: top to bottom, starts at 0
;\3: sprite: a SPRITE_* constant
;\4: movement function: a SPRITEMOVEDATA_* constant
;\5, \6: movement radius: x, y
;\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:
; a combo of MORN, DAY, and/or NITE, or -1 to always appear
;\9: palette: a PAL_NPC_* constant, or 0 for sprite default
;\<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
db \3, \2 + 4, \1 + 4, \4
dn \6, \5
db \7, \8
dn \9, \<10>
db \<11>
dw \<12>, \<13>
; the dummy PlayerObjectTemplate object_event has no def_object_events
if DEF(_NUM_OBJECT_EVENTS)
DEF {_NUM_OBJECT_EVENTS} += 1
endc
ENDM
MACRO trainer
;\1: trainer group
;\2: trainer id
;\3: flag: an EVENT_BEAT_* constant
;\4: seen text
;\5: win text
;\6: loss text
;\7: after-battle text
dw \3
db \1, \2
dw \4, \5, \6, \7
ENDM
MACRO itemball
;\1: item: from constants/item_constants.asm
;\2: quantity: default 1
if _NARG == 1
itemball \1, 1
else
db \1, \2
endc
ENDM
MACRO hiddenitem
;\1: item: from constants/item_constants.asm
;\2: flag: an EVENT_* constant
dwb \2, \1
ENDM
MACRO elevfloor
;\1: floor: a FLOOR_* constant
;\2: warp destination: starts at 1
;\3: map id
db \1, \2
map_id \3
ENDM
MACRO conditional_event
;\1: flag: an EVENT_* constant
;\2: script pointer
dw \1, \2
ENDM
MACRO cmdqueue
;\1: type: a CMDQUEUE_* constant
;\2: data pointer
dbw \1, \2
dw 0 ; filler
ENDM
MACRO stonetable
;\1: warp id
;\2: object_event id
;\3: script pointer
db \1, \2
dw \3
ENDM

222
macros/scripts/movement.asm Normal file
View file

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

View file

@ -0,0 +1,38 @@
; Battle and sprite OAM animations
MACRO oamframe
db \1 ; duration
DEF x = \2
assert !(x & (1 << (OAM_X_FLIP + 1) | 1 << (OAM_Y_FLIP + 1))), \
"oamframe duration overflows into X/Y flip bits"
if _NARG > 2
rept _NARG - 2
DEF x |= 1 << (\3 + 1)
shift
endr
endc
db x ; flags
ENDM
const_def -1, -1
const oamend_command ; $ff
MACRO oamend
db oamend_command
ENDM
const oamrestart_command ; $fe
MACRO oamrestart
db oamrestart_command
ENDM
const oamwait_command ; $fd
MACRO oamwait
db oamwait_command
db \1 ; frames
ENDM
const oamdelete_command ; $fc
MACRO oamdelete
db oamdelete_command
ENDM

View file

@ -0,0 +1,28 @@
MACRO frame
if _NARG <= 2
db \1 ; index
db \2 ; duration
else
; LEGACY: Support for the old name of "oamanim"
oamanim \#
endc
ENDM
const_def -1, -1
const endanim_command ; $ff
MACRO endanim
db endanim_command
ENDM
const setrepeat_command ; $fe
MACRO setrepeat
db setrepeat_command
db \1 ; amount of times to repeat
ENDM
const dorepeat_command ; $fd
MACRO dorepeat
db dorepeat_command
db \1 ; command offset to jump to
ENDM

147
macros/scripts/text.asm Normal file
View file

@ -0,0 +1,147 @@
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
MACRO text_start
db TX_START
ENDM
const TX_RAM ; $01
MACRO text_ram
db TX_RAM
dw \1
ENDM
const TX_BCD ; $02
MACRO text_bcd
db TX_BCD
dw \1
db \2
ENDM
const TX_MOVE ; $03
MACRO text_move
db TX_MOVE
dw \1
ENDM
const TX_BOX ; $04
MACRO text_box
db TX_BOX
dw \1
db \2, \3
ENDM
const TX_LOW ; $05
MACRO text_low
db TX_LOW
ENDM
const TX_PROMPT_BUTTON ; $06
MACRO text_promptbutton
db TX_PROMPT_BUTTON
ENDM
const TX_SCROLL ; $07
MACRO text_scroll
db TX_SCROLL
ENDM
const TX_START_ASM ; $08
MACRO text_asm
db TX_START_ASM
ENDM
const TX_DECIMAL ; $09
MACRO text_decimal
db TX_DECIMAL
dw \1 ; address
dn \2, \3 ; bytes, digits
ENDM
const TX_PAUSE ; $0a
MACRO text_pause
db TX_PAUSE
ENDM
const TX_SOUND_DEX_FANFARE_50_79 ; $0b
MACRO sound_dex_fanfare_50_79
db TX_SOUND_DEX_FANFARE_50_79
ENDM
const TX_DOTS ; $0c
MACRO text_dots
db TX_DOTS
db \1
ENDM
const TX_WAIT_BUTTON ; $0d
MACRO text_waitbutton
db TX_WAIT_BUTTON
ENDM
const TX_SOUND_DEX_FANFARE_20_49 ; $0e
MACRO sound_dex_fanfare_20_49
db TX_SOUND_DEX_FANFARE_20_49
ENDM
const TX_SOUND_ITEM ; $0f
MACRO sound_item
db TX_SOUND_ITEM
ENDM
const TX_SOUND_CAUGHT_MON ; $10
MACRO sound_caught_mon
db TX_SOUND_CAUGHT_MON
ENDM
const TX_SOUND_DEX_FANFARE_80_109 ; $11
MACRO sound_dex_fanfare_80_109
db TX_SOUND_DEX_FANFARE_80_109
ENDM
const TX_SOUND_FANFARE ; $12
MACRO sound_fanfare
db TX_SOUND_FANFARE
ENDM
const TX_SOUND_SLOT_MACHINE_START ; $13
MACRO sound_slot_machine_start
db TX_SOUND_SLOT_MACHINE_START
ENDM
const TX_STRINGBUFFER ; $14
MACRO text_buffer
db TX_STRINGBUFFER
db \1
ENDM
const TX_DAY ; $15
MACRO text_today
db TX_DAY
ENDM
const TX_FAR ; $16
MACRO text_far
db TX_FAR
dw \1
db BANK(\1)
ENDM
DEF NUM_TEXT_CMDS EQU const_value
const_next $50
const TX_END ; $50
MACRO text_end
db TX_END
ENDM