summaryrefslogtreecommitdiff
path: root/asm/macros
diff options
context:
space:
mode:
Diffstat (limited to 'asm/macros')
-rw-r--r--asm/macros/battle_ai_script.inc619
-rw-r--r--asm/macros/battle_anim_script.inc268
-rw-r--r--asm/macros/battle_script.inc1401
-rw-r--r--asm/macros/event.inc231
-rw-r--r--asm/macros/m4a.inc13
-rw-r--r--asm/macros/map.inc80
-rw-r--r--asm/macros/movement.inc234
-rw-r--r--asm/macros/music_voice.inc125
-rw-r--r--asm/macros/pokemon_data.inc2
-rw-r--r--asm/macros/window.inc2
10 files changed, 2709 insertions, 266 deletions
diff --git a/asm/macros/battle_ai_script.inc b/asm/macros/battle_ai_script.inc
new file mode 100644
index 000000000..5e81686bf
--- /dev/null
+++ b/asm/macros/battle_ai_script.inc
@@ -0,0 +1,619 @@
+ .macro if_random_less_than param0, param1
+ .byte 0x0
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_random_greater_than param0, param1
+ .byte 0x1
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_random_equal param0, param1
+ .byte 0x2
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_random_not_equal param0, param1
+ .byte 0x3
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro score param0
+ .byte 0x4
+ .byte \param0
+ .endm
+
+ .macro if_hp_less_than bank, param1, param2
+ .byte 0x5
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_hp_more_than bank, param1, param2
+ .byte 0x6
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_hp_equal bank, param1, param2
+ .byte 0x7
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_hp_not_equal bank, param1, param2
+ .byte 0x8
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_status bank, status1, param2
+ .byte 0x9
+ .byte \bank
+ .4byte \status1
+ .4byte \param2
+ .endm
+
+ .macro if_not_status bank, status1, param2
+ .byte 0xa
+ .byte \bank
+ .4byte \status1
+ .4byte \param2
+ .endm
+
+ .macro if_status2 bank, status2, param2
+ .byte 0xb
+ .byte \bank
+ .4byte \status2
+ .4byte \param2
+ .endm
+
+ .macro if_not_status2 bank, status2, param2
+ .byte 0xc
+ .byte \bank
+ .4byte \status2
+ .4byte \param2
+ .endm
+
+ .macro if_status3 bank, status3, param2
+ .byte 0xd
+ .byte \bank
+ .4byte \status3
+ .4byte \param2
+ .endm
+
+ .macro if_not_status3 bank, status3, param2
+ .byte 0xe
+ .byte \bank
+ .4byte \status3
+ .4byte \param2
+ .endm
+
+ .macro if_side_affecting bank, sidestatus, param2
+ .byte 0xf
+ .byte \bank
+ .4byte \sidestatus
+ .4byte \param2
+ .endm
+
+ .macro if_not_side_affecting bank, sidestatus, param2
+ .byte 0x10
+ .byte \bank
+ .4byte \sidestatus
+ .4byte \param2
+ .endm
+
+ .macro if_less_than param0, param1
+ .byte 0x11
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_more_than param0, param1
+ .byte 0x12
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_equal param0, param1
+ .byte 0x13
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_equal param0, param1
+ .byte 0x14
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_less_than_ptr param0, param1
+ .byte 0x15
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_more_than_ptr param0, param1
+ .byte 0x16
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_equal_ptr param0, param1
+ .byte 0x17
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_equal_ptr param0, param1
+ .byte 0x18
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_move param0, param1
+ .byte 0x19
+ .2byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_move param0, param1
+ .byte 0x1a
+ .2byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_in_bytes param0, param1
+ .byte 0x1b
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_in_bytes param0, param1
+ .byte 0x1c
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_in_hwords param0, param1
+ .byte 0x1d
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_in_hwords param0, param1
+ .byte 0x1e
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_user_has_attacking_move param0
+ .byte 0x1f
+ .4byte \param0
+ .endm
+
+ .macro if_user_has_no_attacking_moves param0
+ .byte 0x20
+ .4byte \param0
+ .endm
+
+ .macro get_turn_count
+ .byte 0x21
+ .endm
+
+ .macro get_type param0
+ .byte 0x22
+ .byte \param0
+ .endm
+
+ .macro get_considered_move_power
+ .byte 0x23
+ .endm
+
+ .macro get_how_powerful_move_is
+ .byte 0x24
+ .endm
+
+ .macro get_last_used_bank_move bank
+ .byte 0x25
+ .byte \bank
+ .endm
+
+ .macro if_equal_ param0, param1
+ .byte 0x26
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_equal_ param0, param1
+ .byte 0x27
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_user_goes param0, param1
+ .byte 0x28
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_user_doesnt_go param0, param1
+ .byte 0x29
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro nullsub_2A
+ .byte 0x2a
+ .endm
+
+ .macro nullsub_2B
+ .byte 0x2b
+ .endm
+
+ .macro count_usable_party_mons bank
+ .byte 0x2c
+ .byte \bank
+ .endm
+
+ .macro get_considered_move
+ .byte 0x2d
+ .endm
+
+ .macro get_considered_move_effect
+ .byte 0x2e
+ .endm
+
+ .macro get_ability bank
+ .byte 0x2f
+ .byte \bank
+ .endm
+
+ .macro get_highest_type_effectiveness
+ .byte 0x30
+ .endm
+
+ .macro if_type_effectiveness param0, param1
+ .byte 0x31
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro nullsub_32
+ .byte 0x32
+ .endm
+
+ .macro nullsub_33
+ .byte 0x33
+ .endm
+
+ .macro if_status_in_party bank, status1, param2
+ .byte 0x34
+ .byte \bank
+ .4byte \status1
+ .4byte \param2
+ .endm
+
+ .macro if_status_not_in_party bank, status1, param2
+ .byte 0x35
+ .byte \bank
+ .4byte \status1
+ .4byte \param2
+ .endm
+
+ .macro get_weather
+ .byte 0x36
+ .endm
+
+ .macro if_effect param0, param1
+ .byte 0x37
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_not_effect param0, param1
+ .byte 0x38
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_stat_level_less_than bank, stat, param2, param3
+ .byte 0x39
+ .byte \bank
+ .byte \stat
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro if_stat_level_more_than bank, stat, param2, param3
+ .byte 0x3a
+ .byte \bank
+ .byte \stat
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro if_stat_level_equal bank, stat, param2, param3
+ .byte 0x3b
+ .byte \bank
+ .byte \stat
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro if_stat_level_not_equal bank, stat, param2, param3
+ .byte 0x3c
+ .byte \bank
+ .byte \stat
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro if_can_faint param0
+ .byte 0x3d
+ .4byte \param0
+ .endm
+
+ .macro if_cant_faint param0
+ .byte 0x3e
+ .4byte \param0
+ .endm
+
+ .macro if_has_move bank, param1, param2
+ .byte 0x3f
+ .byte \bank
+ .2byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_doesnt_have_move bank, param1, param2
+ .byte 0x40
+ .byte \bank
+ .2byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_has_move_with_effect bank, param1, param2
+ .byte 0x41
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_doesnt_have_move_with_effect bank, param1, param2
+ .byte 0x42
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_any_move_disabled_or_encored bank, param1, param2
+ .byte 0x43
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro if_curr_move_disabled_or_encored param0, param1
+ .byte 0x44
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro flee
+ .byte 0x45
+ .endm
+
+ .macro if_random_safari_flee param0
+ .byte 0x46
+ .4byte \param0
+ .endm
+
+ .macro watch
+ .byte 0x47
+ .endm
+
+ .macro get_hold_effect bank
+ .byte 0x48
+ .byte \bank
+ .endm
+
+ .macro get_gender bank
+ .byte 0x49
+ .byte \bank
+ .endm
+
+ .macro is_first_turn_for bank
+ .byte 0x4a
+ .byte \bank
+ .endm
+
+ .macro get_stockpile_count bank
+ .byte 0x4b
+ .byte \bank
+ .endm
+
+ .macro is_double_battle
+ .byte 0x4c
+ .endm
+
+ .macro get_used_held_item bank
+ .byte 0x4d
+ .byte \bank
+ .endm
+
+ .macro get_move_type_from_result
+ .byte 0x4e
+ .endm
+
+ .macro get_move_power_from_result
+ .byte 0x4f
+ .endm
+
+ .macro get_move_effect_from_result
+ .byte 0x50
+ .endm
+
+ .macro get_protect_count bank
+ .byte 0x51
+ .byte \bank
+ .endm
+
+ .macro nullsub_52
+ .byte 0x52
+ .endm
+
+ .macro nullsub_53
+ .byte 0x53
+ .endm
+
+ .macro nullsub_54
+ .byte 0x54
+ .endm
+
+ .macro nullsub_55
+ .byte 0x55
+ .endm
+
+ .macro nullsub_56
+ .byte 0x56
+ .endm
+
+ .macro nullsub_57
+ .byte 0x57
+ .endm
+
+ .macro call param0
+ .byte 0x58
+ .4byte \param0
+ .endm
+
+ .macro goto param0
+ .byte 0x59
+ .4byte \param0
+ .endm
+
+ .macro end
+ .byte 0x5a
+ .endm
+
+ .macro if_level_cond param0, param1
+ .byte 0x5b
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro if_target_taunted param0
+ .byte 0x5c
+ .4byte \param0
+ .endm
+
+ .macro if_target_not_taunted param0
+ .byte 0x5d
+ .4byte \param0
+ .endm
+
+ .macro if_target_is_ally param0
+ .byte 0x5e
+ .4byte \param0
+ .endm
+
+ .macro is_of_type bank, type
+ .byte 0x5f
+ .byte \bank
+ .byte \type
+ .endm
+
+ .macro check_ability bank, ability
+ .byte 0x60
+ .byte \bank
+ .byte \ability
+ .endm
+
+ .macro if_flash_fired bank, param1
+ .byte 0x61
+ .byte \bank
+ .4byte \param1
+ .endm
+
+ .macro if_holds_item bank, param1, param2
+ .byte 0x62
+ .byte \bank
+ .2byte \param1
+ .4byte \param2
+ .endm
+
+@ useful script macros
+ .macro get_curr_move_type
+ get_type AI_TYPE_MOVE
+ .endm
+
+ .macro get_user_type1
+ get_type AI_TYPE1_USER
+ .endm
+
+ .macro get_user_type2
+ get_type AI_TYPE2_USER
+ .endm
+
+ .macro get_target_type1
+ get_type AI_TYPE1_TARGET
+ .endm
+
+ .macro get_target_type2
+ get_type AI_TYPE2_TARGET
+ .endm
+
+ .macro if_ability bank, ability, ptr
+ check_ability \bank, \ability
+ if_equal 1, \ptr
+ .endm
+
+ .macro if_no_ability bank, ability, ptr
+ check_ability \bank, \ability
+ if_equal 0, \ptr
+ .endm
+
+ .macro if_type bank, type, ptr
+ is_of_type \bank, \type
+ if_equal 1, \ptr
+ .endm
+
+ .macro if_no_type bank, type, ptr
+ is_of_type \bank, \type
+ if_equal 0, \ptr
+ .endm
+
+ .macro if_target_faster ptr
+ if_user_goes 1, \ptr
+ .endm
+
+ .macro if_user_faster ptr
+ if_user_goes 0, \ptr
+ .endm
+
+ .macro if_double_battle ptr
+ is_double_battle
+ if_equal 1, \ptr
+ .endm
+
+ .macro if_not_double_battle ptr
+ is_double_battle
+ if_equal 0, \ptr
+ .endm
+
+ .macro if_any_move_disabled bank, ptr
+ if_any_move_disabled_or_encored \bank, 0, \ptr
+ .endm
+
+ .macro if_any_move_encored bank, ptr
+ if_any_move_disabled_or_encored \bank, 1, \ptr
+ .endm
diff --git a/asm/macros/battle_anim_script.inc b/asm/macros/battle_anim_script.inc
new file mode 100644
index 000000000..b26d1218d
--- /dev/null
+++ b/asm/macros/battle_anim_script.inc
@@ -0,0 +1,268 @@
+@ commands
+
+ .macro loadspritegfx param0
+ .byte 0x0
+ .2byte \param0
+ .endm
+
+ .macro unloadspritegfx param0
+ .byte 0x1
+ .2byte \param0
+ .endm
+
+ .macro createsprite template, priority, argv:vararg
+ .byte 0x02
+ .4byte \template
+ .byte \priority
+ .byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
+.Lsprite_\@_1:
+ .2byte \argv
+.Lsprite_\@_2:
+ .endm
+
+ .macro createvisualtask addr, priority, argv:vararg
+ .byte 0x03
+ .4byte \addr
+ .byte \priority
+ .byte (.Lcreatetask_\@_2 - .Lcreatetask_\@_1) / 2
+.Lcreatetask_\@_1:
+ .2byte \argv
+.Lcreatetask_\@_2:
+ .endm
+
+ .macro delay param0
+ .byte 0x4
+ .byte \param0
+ .endm
+
+ .macro waitforvisualfinish
+ .byte 0x5
+ .endm
+
+ .macro hang1
+ .byte 0x6
+ .endm
+
+ .macro hang2
+ .byte 0x7
+ .endm
+
+ .macro end
+ .byte 0x8
+ .endm
+
+ .macro playse param0
+ .byte 0x9
+ .2byte \param0
+ .endm
+
+ .macro monbg bank
+ .byte 0xa
+ .byte \bank
+ .endm
+
+ .macro clearmonbg bank
+ .byte 0xb
+ .byte \bank
+ .endm
+
+ .macro setalpha param0
+ .byte 0xc
+ .2byte \param0
+ .endm
+
+ .macro blendoff
+ .byte 0xd
+ .endm
+
+ .macro call param0
+ .byte 0xe
+ .4byte \param0
+ .endm
+
+ .macro return
+ .byte 0xf
+ .endm
+
+ .macro setarg param0, param1
+ .byte 0x10
+ .byte \param0
+ .2byte \param1
+ .endm
+
+ .macro choosetwoturnanim param0, param1
+ .byte 0x11
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro jumpifmoveturn param0, param1
+ .byte 0x12
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro goto param0
+ .byte 0x13
+ .4byte \param0
+ .endm
+
+ .macro fadetobg param0
+ .byte 0x14
+ .byte \param0
+ .endm
+
+ .macro restorebg
+ .byte 0x15
+ .endm
+
+ .macro waitbgfadeout
+ .byte 0x16
+ .endm
+
+ .macro waitbgfadein
+ .byte 0x17
+ .endm
+
+ .macro changebg param0
+ .byte 0x18
+ .byte \param0
+ .endm
+
+ .macro playsewithpan param0, param1
+ .byte 0x19
+ .2byte \param0
+ .byte \param1
+ .endm
+
+ .macro setpan param0
+ .byte 0x1a
+ .byte \param0
+ .endm
+
+ .macro panse_1B param0, param1, param2, param3, param4
+ .byte 0x1b
+ .2byte \param0
+ .byte \param1
+ .byte \param2
+ .byte \param3
+ .byte \param4
+ .endm
+
+ .macro loopsewithpan param0, param1, param2, param3
+ .byte 0x1c
+ .2byte \param0
+ .byte \param1
+ .byte \param2
+ .byte \param3
+ .endm
+
+ .macro waitplaysewithpan param0, param1, param2
+ .byte 0x1d
+ .2byte \param0
+ .byte \param1
+ .byte \param2
+ .endm
+
+ .macro setbldcnt param0
+ .byte 0x1e
+ .2byte \param0
+ .endm
+
+ .macro createsoundtask addr, argv:vararg
+ .byte 0x1F
+ .4byte \addr
+ .byte (.Lcreatetask_1F_\@_2 - .Lcreatetask_1F_\@_1) / 2
+.Lcreatetask_1F_\@_1:
+ .2byte \argv
+.Lcreatetask_1F_\@_2:
+ .endm
+
+ .macro waitsound
+ .byte 0x20
+ .endm
+
+ .macro jumpargeq param0, param1, param2
+ .byte 0x21
+ .byte \param0
+ .2byte \param1
+ .4byte \param2
+ .endm
+
+ .macro monbg_22 bank
+ .byte 0x22
+ .byte \bank
+ .endm
+
+ .macro clearmonbg_23 bank
+ .byte 0x23
+ .byte \bank
+ .endm
+
+ .macro jumpifcontest param0
+ .byte 0x24
+ .4byte \param0
+ .endm
+
+ .macro fadetobgfromset param0, param1, param2
+ .byte 0x25
+ .byte \param0
+ .byte \param1
+ .byte \param2
+ .endm
+
+ .macro panse_26 param0, param1, param2, param3, param4
+ .byte 0x26
+ .2byte \param0
+ .byte \param1
+ .byte \param2
+ .byte \param3
+ .byte \param4
+ .endm
+
+ .macro panse_27 param0, param1, param2, param3, param4
+ .byte 0x27
+ .2byte \param0
+ .byte \param1
+ .byte \param2
+ .byte \param3
+ .byte \param4
+ .endm
+
+ .macro monbgprio_28 bank
+ .byte 0x28
+ .byte \bank
+ .endm
+
+ .macro monbgprio_29
+ .byte 0x29
+ .endm
+
+ .macro monbgprio_2A bank
+ .byte 0x2a
+ .byte \bank
+ .endm
+
+ .macro invisible bank
+ .byte 0x2b
+ .byte \bank
+ .endm
+
+ .macro visible bank
+ .byte 0x2c
+ .byte \bank
+ .endm
+
+ .macro doublebattle_2D bank
+ .byte 0x2d
+ .byte \bank
+ .endm
+
+ .macro doublebattle_2E bank
+ .byte 0x2e
+ .byte \bank
+ .endm
+
+ .macro stopsound
+ .byte 0x2f
+ .endm
diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc
new file mode 100644
index 000000000..c03d78df7
--- /dev/null
+++ b/asm/macros/battle_script.inc
@@ -0,0 +1,1401 @@
+@ commands
+ .macro attackcanceler
+ .byte 0x0
+ .endm
+
+ .macro accuracycheck param0, param1
+ .byte 0x1
+ .4byte \param0
+ .2byte \param1
+ .endm
+
+ .macro attackstring
+ .byte 0x2
+ .endm
+
+ .macro ppreduce
+ .byte 0x3
+ .endm
+
+ .macro critcalc
+ .byte 0x4
+ .endm
+
+ .macro damagecalc
+ .byte 0x5
+ .endm
+
+ .macro typecalc
+ .byte 0x6
+ .endm
+
+ .macro adjustnormaldamage
+ .byte 0x7
+ .endm
+
+ .macro adjustnormaldamage2
+ .byte 0x8
+ .endm
+
+ .macro attackanimation
+ .byte 0x9
+ .endm
+
+ .macro waitanimation
+ .byte 0xa
+ .endm
+
+ .macro healthbarupdate bank
+ .byte 0xb
+ .byte \bank
+ .endm
+
+ .macro datahpupdate bank
+ .byte 0xc
+ .byte \bank
+ .endm
+
+ .macro critmessage
+ .byte 0xd
+ .endm
+
+ .macro effectivenesssound
+ .byte 0xe
+ .endm
+
+ .macro resultmessage
+ .byte 0xf
+ .endm
+
+ .macro printstring param0
+ .byte 0x10
+ .2byte \param0
+ .endm
+
+ .macro printselectionstring param0
+ .byte 0x11
+ .2byte \param0
+ .endm
+
+ .macro waitmessage param0
+ .byte 0x12
+ .2byte \param0
+ .endm
+
+ .macro printfromtable param0
+ .byte 0x13
+ .4byte \param0
+ .endm
+
+ .macro printselectionstringfromtable param0
+ .byte 0x14
+ .4byte \param0
+ .endm
+
+ .macro seteffectwithchance
+ .byte 0x15
+ .endm
+
+ .macro seteffectprimary
+ .byte 0x16
+ .endm
+
+ .macro seteffectsecondary
+ .byte 0x17
+ .endm
+
+ .macro clearstatusfromeffect bank
+ .byte 0x18
+ .byte \bank
+ .endm
+
+ .macro tryfaintmon bank, param1, param2
+ .byte 0x19
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro dofaintanimation bank
+ .byte 0x1a
+ .byte \bank
+ .endm
+
+ .macro cleareffectsonfaint bank
+ .byte 0x1b
+ .byte \bank
+ .endm
+
+ .macro jumpifstatus bank, status1, param2
+ .byte 0x1c
+ .byte \bank
+ .4byte \status1
+ .4byte \param2
+ .endm
+
+ .macro jumpifstatus2 bank, status2, param2
+ .byte 0x1d
+ .byte \bank
+ .4byte \status2
+ .4byte \param2
+ .endm
+
+ .macro jumpifability param0, ability, param2
+ .byte 0x1e
+ .byte \param0
+ .byte \ability
+ .4byte \param2
+ .endm
+
+ .macro jumpifsideaffecting bank, sidestatus, param2
+ .byte 0x1f
+ .byte \bank
+ .2byte \sidestatus
+ .4byte \param2
+ .endm
+
+ .macro jumpifstat bank, ifflag, stat, param3, param4
+ .byte 0x20
+ .byte \bank
+ .byte \ifflag
+ .byte \stat
+ .byte \param3
+ .4byte \param4
+ .endm
+
+ .macro jumpifstatus3condition bank, status3, param2, param3
+ .byte 0x21
+ .byte \bank
+ .4byte \status3
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro jumpiftype bank, type, param2
+ .byte 0x22
+ .byte \bank
+ .byte \type
+ .4byte \param2
+ .endm
+
+ .macro getexp bank
+ .byte 0x23
+ .byte \bank
+ .endm
+
+ .macro atk24 param0
+ .byte 0x24
+ .4byte \param0
+ .endm
+
+ .macro movevaluescleanup
+ .byte 0x25
+ .endm
+
+ .macro setmultihit param0
+ .byte 0x26
+ .byte \param0
+ .endm
+
+ .macro decrementmultihit param0
+ .byte 0x27
+ .4byte \param0
+ .endm
+
+ .macro goto param0
+ .byte 0x28
+ .4byte \param0
+ .endm
+
+ .macro jumpifbyte ifflag, param1, param2, param3
+ .byte 0x29
+ .byte \ifflag
+ .4byte \param1
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro jumpifhalfword ifflag, param1, param2, param3
+ .byte 0x2a
+ .byte \ifflag
+ .4byte \param1
+ .2byte \param2
+ .4byte \param3
+ .endm
+
+ .macro jumpifword ifflag, param1, param2, param3
+ .byte 0x2b
+ .byte \ifflag
+ .4byte \param1
+ .4byte \param2
+ .4byte \param3
+ .endm
+
+ .macro jumpifarrayequal param0, param1, param2, param3
+ .byte 0x2c
+ .4byte \param0
+ .4byte \param1
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro jumpifarraynotequal param0, param1, param2, param3
+ .byte 0x2d
+ .4byte \param0
+ .4byte \param1
+ .byte \param2
+ .4byte \param3
+ .endm
+
+ .macro setbyte param0, param1
+ .byte 0x2e
+ .4byte \param0
+ .byte \param1
+ .endm
+
+ .macro addbyte param0, param1
+ .byte 0x2f
+ .4byte \param0
+ .byte \param1
+ .endm
+
+ .macro subbyte param0, param1
+ .byte 0x30
+ .4byte \param0
+ .byte \param1
+ .endm
+
+ .macro copyarray param0, param1, param2
+ .byte 0x31
+ .4byte \param0
+ .4byte \param1
+ .byte \param2
+ .endm
+
+ .macro copyarraywithindex param0, param1, param2, param3
+ .byte 0x32
+ .4byte \param0
+ .4byte \param1
+ .4byte \param2
+ .byte \param3
+ .endm
+
+ .macro orbyte param0, param1
+ .byte 0x33
+ .4byte \param0
+ .byte \param1
+ .endm
+
+ .macro orhalfword param0, param1
+ .byte 0x34
+ .4byte \param0
+ .2byte \param1
+ .endm
+
+ .macro orword param0, param1
+ .byte 0x35
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro bicbyte param0, param1
+ .byte 0x36
+ .4byte \param0
+ .byte \param1
+ .endm
+
+ .macro bichalfword param0, param1
+ .byte 0x37
+ .4byte \param0
+ .2byte \param1
+ .endm
+
+ .macro bicword param0, param1
+ .byte 0x38
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro pause param0
+ .byte 0x39
+ .2byte \param0
+ .endm
+
+ .macro waitstate
+ .byte 0x3a
+ .endm
+
+ .macro healthbar_update bank
+ .byte 0x3b
+ .byte \bank
+ .endm
+
+ .macro return
+ .byte 0x3c
+ .endm
+
+ .macro end
+ .byte 0x3d
+ .endm
+
+ .macro end2
+ .byte 0x3e
+ .endm
+
+ .macro end3
+ .byte 0x3f
+ .endm
+
+ .macro jumpifaffectedbyprotect param0
+ .byte 0x40
+ .4byte \param0
+ .endm
+
+ .macro call param0
+ .byte 0x41
+ .4byte \param0
+ .endm
+
+ .macro jumpiftype2 bank, type, param2
+ .byte 0x42
+ .byte \bank
+ .byte \type
+ .4byte \param2
+ .endm
+
+ .macro jumpifabilitypresent ability, param1
+ .byte 0x43
+ .byte \ability
+ .4byte \param1
+ .endm
+
+ .macro endselectionscript
+ .byte 0x44
+ .endm
+
+ .macro playanimation bank, param1, param2
+ .byte 0x45
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro playanimation2 bank, param1, param2
+ .byte 0x46
+ .byte \bank
+ .4byte \param1
+ .4byte \param2
+ .endm
+
+ .macro setgraphicalstatchangevalues
+ .byte 0x47
+ .endm
+
+ .macro playstatchangeanimation bank, param1, param2
+ .byte 0x48
+ .byte \bank
+ .byte \param1
+ .byte \param2
+ .endm
+
+ .macro moveend param0, param1
+ .byte 0x49
+ .byte \param0
+ .byte \param1
+ .endm
+
+ .macro typecalc2
+ .byte 0x4a
+ .endm
+
+ .macro returnatktoball
+ .byte 0x4b
+ .endm
+
+ .macro getswitchedmondata bank
+ .byte 0x4c
+ .byte \bank
+ .endm
+
+ .macro switchindataupdate bank
+ .byte 0x4d
+ .byte \bank
+ .endm
+
+ .macro switchinanim bank, dontclearsubstitutebit
+ .byte 0x4e
+ .byte \bank
+ .byte \dontclearsubstitutebit
+ .endm
+
+ .macro jumpifcantswitch bank, param1
+ .byte 0x4f
+ .byte \bank
+ .4byte \param1
+ .endm
+
+ .macro openpartyscreen param0, param1
+ .byte 0x50
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro switchhandleorder bank, param1
+ .byte 0x51
+ .byte \bank
+ .byte \param1
+ .endm
+
+ .macro switchineffects bank
+ .byte 0x52
+ .byte \bank
+ .endm
+
+ .macro trainerslidein bank
+ .byte 0x53
+ .byte \bank
+ .endm
+
+ .macro playse param0
+ .byte 0x54
+ .2byte \param0
+ .endm
+
+ .macro fanfare param0
+ .byte 0x55
+ .2byte \param0
+ .endm
+
+ .macro playfaintcry bank
+ .byte 0x56
+ .byte \bank
+ .endm
+
+ .macro atk57
+ .byte 0x57
+ .endm
+
+ .macro returntoball bank
+ .byte 0x58
+ .byte \bank
+ .endm
+
+ .macro handlelearnnewmove param0, param1, param2
+ .byte 0x59
+ .4byte \param0
+ .4byte \param1
+ .byte \param2
+ .endm
+
+ .macro yesnoboxlearnmove param0
+ .byte 0x5a
+ .4byte \param0
+ .endm
+
+ .macro yesnoboxstoplearningmove param0
+ .byte 0x5b
+ .4byte \param0
+ .endm
+
+ .macro hitanimation bank
+ .byte 0x5c
+ .byte \bank
+ .endm
+
+ .macro getmoneyreward
+ .byte 0x5d
+ .endm
+
+ .macro atk5E bank
+ .byte 0x5e
+ .byte \bank
+ .endm
+
+ .macro swapattackerwithtarget
+ .byte 0x5f
+ .endm
+
+ .macro incrementgamestat param0
+ .byte 0x60
+ .byte \param0
+ .endm
+
+ .macro drawpartystatussummary bank
+ .byte 0x61
+ .byte \bank
+ .endm
+
+ .macro hidepartystatussummary bank
+ .byte 0x62
+ .byte \bank
+ .endm
+
+ .macro jumptorandomattack param0
+ .byte 0x63
+ .byte \param0
+ .endm
+
+ .macro statusanimation bank
+ .byte 0x64
+ .byte \bank
+ .endm
+
+ .macro status2animation bank, status2
+ .byte 0x65
+ .byte \bank
+ .4byte \status2
+ .endm
+
+ .macro chosenstatusanimation bank, param1, param2
+ .byte 0x66
+ .byte \bank
+ .byte \param1
+ .4byte \param2
+ .endm
+
+ .macro yesnobox
+ .byte 0x67
+ .endm
+
+ .macro cancelallactions
+ .byte 0x68
+ .endm
+
+ .macro adjustsetdamage
+ .byte 0x69
+ .endm
+
+ .macro removeitem bank
+ .byte 0x6a
+ .byte \bank
+ .endm
+
+ .macro atknameinbuff1
+ .byte 0x6b
+ .endm
+
+ .macro drawlvlupbox
+ .byte 0x6c
+ .endm
+
+ .macro resetsentmonsvalue
+ .byte 0x6d
+ .endm
+
+ .macro setatktoplayer0
+ .byte 0x6e
+ .endm
+
+ .macro makevisible bank
+ .byte 0x6f
+ .byte \bank
+ .endm
+
+ .macro recordlastability bank
+ .byte 0x70
+ .byte \bank
+ .endm
+
+ .macro buffermovetolearn
+ .byte 0x71
+ .endm
+
+ .macro jumpifplayerran param0
+ .byte 0x72
+ .4byte \param0
+ .endm
+
+ .macro hpthresholds bank
+ .byte 0x73
+ .byte \bank
+ .endm
+
+ .macro hpthresholds2 bank
+ .byte 0x74
+ .byte \bank
+ .endm
+
+ .macro useitemonopponent
+ .byte 0x75
+ .endm
+
+ .macro various bank, param1
+ .byte 0x76
+ .byte \bank
+ .byte \param1
+ .endm
+
+ .macro setprotectlike
+ .byte 0x77
+ .endm
+
+ .macro faintifabilitynotdamp
+ .byte 0x78
+ .endm
+
+ .macro setatkhptozero
+ .byte 0x79
+ .endm
+
+ .macro jumpifnexttargetvalid param0
+ .byte 0x7a
+ .4byte \param0
+ .endm
+
+ .macro tryhealhalfhealth param0, bank
+ .byte 0x7b
+ .4byte \param0
+ .byte \bank
+ .endm
+
+ .macro trymirrormove
+ .byte 0x7c
+ .endm
+
+ .macro setrain
+ .byte 0x7d
+ .endm
+
+ .macro setreflect
+ .byte 0x7e
+ .endm
+
+ .macro setseeded
+ .byte 0x7f
+ .endm
+
+ .macro manipulatedamage param0
+ .byte 0x80
+ .byte \param0
+ .endm
+
+ .macro trysetrest param0
+ .byte 0x81
+ .4byte \param0
+ .endm
+
+ .macro jumpifnotfirstturn param0
+ .byte 0x82
+ .4byte \param0
+ .endm
+
+ .macro nop
+ .byte 0x83
+ .endm
+
+ .macro jumpifcantmakeasleep param0
+ .byte 0x84
+ .4byte \param0
+ .endm
+
+ .macro stockpile
+ .byte 0x85
+ .endm
+
+ .macro stockpiletobasedamage param0
+ .byte 0x86
+ .4byte \param0
+ .endm
+
+ .macro stockpiletohpheal param0
+ .byte 0x87
+ .4byte \param0
+ .endm
+
+ .macro negativedamage
+ .byte 0x88
+ .endm
+
+ .macro statbuffchange param0, param1
+ .byte 0x89
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro normalisebuffs
+ .byte 0x8a
+ .endm
+
+ .macro setbide
+ .byte 0x8b
+ .endm
+
+ .macro confuseifrepeatingattackends
+ .byte 0x8c
+ .endm
+
+ .macro setmultihitcounter param0
+ .byte 0x8d
+ .byte \param0
+ .endm
+
+ .macro initmultihitstring
+ .byte 0x8e
+ .endm
+
+ .macro forcerandomswitch param0
+ .byte 0x8f
+ .4byte \param0
+ .endm
+
+ .macro tryconversiontypechange param0
+ .byte 0x90
+ .4byte \param0
+ .endm
+
+ .macro givepaydaymoney
+ .byte 0x91
+ .endm
+
+ .macro setlightscreen
+ .byte 0x92
+ .endm
+
+ .macro tryKO param0
+ .byte 0x93
+ .4byte \param0
+ .endm
+
+ .macro damagetohalftargethp
+ .byte 0x94
+ .endm
+
+ .macro setsandstorm
+ .byte 0x95
+ .endm
+
+ .macro weatherdamage
+ .byte 0x96
+ .endm
+
+ .macro tryinfatuating param0
+ .byte 0x97
+ .4byte \param0
+ .endm
+
+ .macro updatestatusicon bank
+ .byte 0x98
+ .byte \bank
+ .endm
+
+ .macro setmist
+ .byte 0x99
+ .endm
+
+ .macro setfocusenergy
+ .byte 0x9a
+ .endm
+
+ .macro transformdataexecution
+ .byte 0x9b
+ .endm
+
+ .macro setsubstitute
+ .byte 0x9c
+ .endm
+
+ .macro mimicattackcopy param0
+ .byte 0x9d
+ .4byte \param0
+ .endm
+
+ .macro metronome
+ .byte 0x9e
+ .endm
+
+ .macro dmgtolevel
+ .byte 0x9f
+ .endm
+
+ .macro psywavedamageeffect
+ .byte 0xa0
+ .endm
+
+ .macro counterdamagecalculator param0
+ .byte 0xa1
+ .4byte \param0
+ .endm
+
+ .macro mirrorcoatdamagecalculator param0
+ .byte 0xa2
+ .4byte \param0
+ .endm
+
+ .macro disablelastusedattack param0
+ .byte 0xa3
+ .4byte \param0
+ .endm
+
+ .macro trysetencore param0
+ .byte 0xa4
+ .4byte \param0
+ .endm
+
+ .macro painsplitdmgcalc param0
+ .byte 0xa5
+ .4byte \param0
+ .endm
+
+ .macro settypetorandomresistance param0
+ .byte 0xa6
+ .4byte \param0
+ .endm
+
+ .macro setalwayshitflag
+ .byte 0xa7
+ .endm
+
+ .macro copymovepermanently param0
+ .byte 0xa8
+ .4byte \param0
+ .endm
+
+ .macro trychoosesleeptalkmove param0
+ .byte 0xa9
+ .4byte \param0
+ .endm
+
+ .macro setdestinybond
+ .byte 0xaa
+ .endm
+
+ .macro trysetdestinybondtohappen
+ .byte 0xab
+ .endm
+
+ .macro remaininghptopower
+ .byte 0xac
+ .endm
+
+ .macro tryspiteppreduce param0
+ .byte 0xad
+ .4byte \param0
+ .endm
+
+ .macro healpartystatus
+ .byte 0xae
+ .endm
+
+ .macro cursetarget param0
+ .byte 0xaf
+ .4byte \param0
+ .endm
+
+ .macro trysetspikes param0
+ .byte 0xb0
+ .4byte \param0
+ .endm
+
+ .macro setforesight
+ .byte 0xb1
+ .endm
+
+ .macro trysetperishsong param0
+ .byte 0xb2
+ .4byte \param0
+ .endm
+
+ .macro rolloutdamagecalculation
+ .byte 0xb3
+ .endm
+
+ .macro jumpifconfusedandstatmaxed stat, param1
+ .byte 0xb4
+ .byte \stat
+ .4byte \param1
+ .endm
+
+ .macro furycuttercalc
+ .byte 0xb5
+ .endm
+
+ .macro happinesstodamagecalculation
+ .byte 0xb6
+ .endm
+
+ .macro presentdamagecalculation
+ .byte 0xb7
+ .endm
+
+ .macro setsafeguard
+ .byte 0xb8
+ .endm
+
+ .macro magnitudedamagecalculation
+ .byte 0xb9
+ .endm
+
+ .macro jumpifnopursuitswitchdmg param0
+ .byte 0xba
+ .4byte \param0
+ .endm
+
+ .macro setsunny
+ .byte 0xbb
+ .endm
+
+ .macro maxattackhalvehp param0
+ .byte 0xbc
+ .4byte \param0
+ .endm
+
+ .macro copyfoestats param0
+ .byte 0xbd
+ .4byte \param0
+ .endm
+
+ .macro rapidspinfree
+ .byte 0xbe
+ .endm
+
+ .macro setdefensecurlbit
+ .byte 0xbf
+ .endm
+
+ .macro recoverbasedonsunlight param0
+ .byte 0xc0
+ .4byte \param0
+ .endm
+
+ .macro hiddenpowercalc
+ .byte 0xc1
+ .endm
+
+ .macro selectfirstvalidtarget
+ .byte 0xc2
+ .endm
+
+ .macro trysetfutureattack param0
+ .byte 0xc3
+ .4byte \param0
+ .endm
+
+ .macro trydobeatup param0, param1
+ .byte 0xc4
+ .4byte \param0
+ .4byte \param1
+ .endm
+
+ .macro setsemiinvulnerablebit
+ .byte 0xc5
+ .endm
+
+ .macro clearsemiinvulnerablebit
+ .byte 0xc6
+ .endm
+
+ .macro setminimize
+ .byte 0xc7
+ .endm
+
+ .macro sethail
+ .byte 0xc8
+ .endm
+
+ .macro jumpifattackandspecialattackcannotfall param0
+ .byte 0xc9
+ .4byte \param0
+ .endm
+
+ .macro setforcedtarget
+ .byte 0xca
+ .endm
+
+ .macro setcharge
+ .byte 0xcb
+ .endm
+
+ .macro callterrainattack
+ .byte 0xcc
+ .endm
+
+ .macro cureifburnedparalysedorpoisoned param0
+ .byte 0xcd
+ .4byte \param0
+ .endm
+
+ .macro settorment param0
+ .byte 0xce
+ .4byte \param0
+ .endm
+
+ .macro jumpifnodamage param0
+ .byte 0xcf
+ .4byte \param0
+ .endm
+
+ .macro settaunt param0
+ .byte 0xd0
+ .4byte \param0
+ .endm
+
+ .macro trysethelpinghand param0
+ .byte 0xd1
+ .4byte \param0
+ .endm
+
+ .macro tryswapitems param0
+ .byte 0xd2
+ .4byte \param0
+ .endm
+
+ .macro trycopyability param0
+ .byte 0xd3
+ .4byte \param0
+ .endm
+
+ .macro trywish param0, param1
+ .byte 0xd4
+ .byte \param0
+ .4byte \param1
+ .endm
+
+ .macro trysetroots param0
+ .byte 0xd5
+ .4byte \param0
+ .endm
+
+ .macro doubledamagedealtifdamaged
+ .byte 0xd6
+ .endm
+
+ .macro setyawn param0
+ .byte 0xd7
+ .4byte \param0
+ .endm
+
+ .macro setdamagetohealthdifference param0
+ .byte 0xd8
+ .4byte \param0
+ .endm
+
+ .macro scaledamagebyhealthratio
+ .byte 0xd9
+ .endm
+
+ .macro tryswapabilities param0
+ .byte 0xda
+ .4byte \param0
+ .endm
+
+ .macro tryimprision param0
+ .byte 0xdb
+ .4byte \param0
+ .endm
+
+ .macro trysetgrudge param0
+ .byte 0xdc
+ .4byte \param0
+ .endm
+
+ .macro weightdamagecalculation
+ .byte 0xdd
+ .endm
+
+ .macro asistattackselect param0
+ .byte 0xde
+ .4byte \param0
+ .endm
+
+ .macro trysetmagiccoat param0
+ .byte 0xdf
+ .4byte \param0
+ .endm
+
+ .macro trysetsnatch param0
+ .byte 0xe0
+ .4byte \param0
+ .endm
+
+ .macro trygetintimidatetarget param0
+ .byte 0xe1
+ .4byte \param0
+ .endm
+
+ .macro switchoutabilities bank
+ .byte 0xe2
+ .byte \bank
+ .endm
+
+ .macro jumpifhasnohp bank, param1
+ .byte 0xe3
+ .byte \bank
+ .4byte \param1
+ .endm
+
+ .macro getsecretpowereffect
+ .byte 0xe4
+ .endm
+
+ .macro pickup
+ .byte 0xe5
+ .endm
+
+ .macro docastformchangeanimation
+ .byte 0xe6
+ .endm
+
+ .macro trycastformdatachange
+ .byte 0xe7
+ .endm
+
+ .macro settypebasedhalvers param0
+ .byte 0xe8
+ .4byte \param0
+ .endm
+
+ .macro setweatherballtype
+ .byte 0xe9
+ .endm
+
+ .macro tryrecycleitem param0
+ .byte 0xea
+ .4byte \param0
+ .endm
+
+ .macro settypetoterrain param0
+ .byte 0xeb
+ .4byte \param0
+ .endm
+
+ .macro pursuitrelated param0
+ .byte 0xec
+ .4byte \param0
+ .endm
+
+ .macro snatchsetbattlers
+ .byte 0xed
+ .endm
+
+ .macro removelightscreenreflect
+ .byte 0xee
+ .endm
+
+ .macro handleballthrow
+ .byte 0xef
+ .endm
+
+ .macro givecaughtmon
+ .byte 0xf0
+ .endm
+
+ .macro trysetcaughtmondexflags param0
+ .byte 0xf1
+ .4byte \param0
+ .endm
+
+ .macro displaydexinfo
+ .byte 0xf2
+ .endm
+
+ .macro trygivecaughtmonnick param0
+ .byte 0xf3
+ .4byte \param0
+ .endm
+
+ .macro subattackerhpbydmg
+ .byte 0xf4
+ .endm
+
+ .macro removeattackerstatus1
+ .byte 0xf5
+ .endm
+
+ .macro finishaction
+ .byte 0xf6
+ .endm
+
+ .macro finishturn
+ .byte 0xf7
+ .endm
+
+ .macro trainerslideout param0
+ .byte 0xf8
+ .byte \param0
+ .endm
+
+@ various command changed to more readable macros
+ .macro cancelmultiturnmoves bank
+ various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES
+ .endm
+
+ .macro setmagiccoattarget bank
+ various \bank, VARIOUS_SET_MAGIC_COAT_TARGET
+ .endm
+
+ .macro getifcantrunfrombattle bank
+ various \bank, VARIOUS_IS_RUNNING_IMPOSSIBLE
+ .endm
+
+ .macro getmovetarget bank
+ various \bank, VARIOUS_GET_MOVE_TARGET
+ .endm
+
+ .macro various4 bank
+ various \bank, 4
+ .endm
+
+ .macro resetintrimidatetracebits bank
+ various \bank, VARIOUS_RESET_INTIMIDATE_TRACE_BITS
+ .endm
+
+ .macro updatechoicemoveonlvlup bank
+ various \bank, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP
+ .endm
+
+ .macro various7 bank
+ various \bank, 7
+ .endm
+
+ .macro various8 bank
+ various \bank, 8
+ .endm
+
+ .macro various9 bank
+ various \bank, 9
+ .endm
+
+ .macro various10 bank
+ various \bank, 10
+ .endm
+
+ .macro various11 bank
+ various \bank, 11
+ .endm
+
+ .macro various12 bank
+ various \bank, 12
+ .endm
+
+ .macro forfeityesnobox bank
+ various \bank, VARIOUS_EMIT_YESNOBOX
+ .endm
+
+ .macro various14 bank
+ various \bank, 14
+ .endm
+
+ .macro various15 bank
+ various \bank, 15
+ .endm
+
+ .macro various16 bank
+ various \bank, 16
+ .endm
+
+ .macro various17 bank
+ various \bank, 17
+ .endm
+
+ .macro waitcry bank
+ various \bank, VARIOUS_WAIT_CRY
+ .endm
+
+ .macro returnopponentmon1toball bank
+ various \bank, VARIOUS_RETURN_OPPONENT_MON1
+ .endm
+
+ .macro returnopponentmon2toball bank
+ various \bank, VARIOUS_RETURN_OPPONENT_MON2
+ .endm
+
+ .macro various21 bank
+ various \bank, 21
+ .endm
+
+ .macro various22 bank
+ various \bank, 22
+ .endm
+
+ .macro various23 bank
+ various \bank, 23
+ .endm
+
+ .macro various24 bank
+ various \bank, 24
+ .endm
+
+ .macro setoutcomeonteleport bank
+ various \bank, VARIOUS_SET_TELEPORT_OUTCOME
+ .endm
+
+ .macro playtrainerdefeatbgm bank
+ various \bank, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC
+ .endm
+
+@ helpful macros
+ .macro setstatchanger stat, stages, down
+ setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
+ .endm
+
+ .macro setmoveeffect effect
+ setbyte cEFFECT_CHOOSER \effect
+ .endm
+
+ .macro chosenstatus1animation bank, status
+ chosenstatusanimation \bank 0x0 \status
+ .endm
+
+ .macro chosenstatus2animation bank, status
+ chosenstatusanimation \bank 0x1 \status
+ .endm
+
+ .macro sethword dst, value
+ setbyte \dst, \value & 0xFF
+ setbyte \dst + 1, (\value >> 8) & 0xFF
+ .endm
+
+ .macro setword dst, value
+ setbyte \dst, \value & 0xFF
+ setbyte \dst + 1, (\value >> 8) & 0xFF
+ setbyte \dst + 2, (\value >> 16) & 0xFF
+ setbyte \dst + 3, (\value >> 24) & 0xFF
+ .endm
+
+ .macro copybyte dst, src
+ copyarray \dst, \src, 0x1
+ .endm
+
+ .macro copyhword dst, src
+ copyarray \dst, \src, 0x2
+ .endm
+
+ .macro copyword dst, src
+ copyarray \dst, \src, 0x4
+ .endm
+
+ .macro jumpifbytenotequal byte1, byte2, jumpptr
+ jumpifarraynotequal \byte1, \byte2, 0x1, \jumpptr
+ .endm
+
+ .macro jumpifbyteequal byte1, byte2, jumpptr
+ jumpifarrayequal \byte1, \byte2, 0x1, \jumpptr
+ .endm
+
+ .macro jumpifmove move, jumpptr
+ jumpifhalfword CMP_EQUAL, gCurrentMove, \move, \jumpptr
+ .endm
+
+ .macro jumpifnotmove move, jumpptr
+ jumpifhalfword CMP_NOT_EQUAL, gCurrentMove, \move, \jumpptr
+ .endm
+
+ .macro jumpifstatus3 bank, status, jumpptr
+ jumpifstatus3condition \bank, \status, 0x0, \jumpptr
+ .endm
+
+ .macro jumpifnostatus3 bank, status, jumpptr
+ jumpifstatus3condition \bank, \status, 0x1, \jumpptr
+ .endm
+
+ .macro jumpifmovehadnoeffect jumpptr
+ jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_NO_EFFECT, \jumpptr
+ .endm
+
+ .macro jumpifbattletype flags, jumpptr
+ jumpifword CMP_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
+ .endm
+
+ .macro jumpifnotbattletype flags, jumpptr
+ jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
+ .endm
diff --git a/asm/macros/event.inc b/asm/macros/event.inc
index 69cdb38e5..6b9227442 100644
--- a/asm/macros/event.inc
+++ b/asm/macros/event.inc
@@ -1,20 +1,20 @@
@ Does nothing.
- .macro nop
+ .macro nop
.byte 0x00
.endm
@ Does nothing.
- .macro nop1
+ .macro nop1
.byte 0x01
.endm
@ Terminates script execution.
- .macro end
+ .macro end
.byte 0x02
.endm
@ Jumps back to after the last-executed call statement, and continues script execution from there.
- .macro return
+ .macro return
.byte 0x03
.endm
@@ -71,12 +71,12 @@
.endm
@ Executes a script stored in a default RAM location.
- .macro gotoram
+ .macro gotoram
.byte 0x0c
.endm
@ Terminates script execution and "resets the script RAM".
- .macro killscript
+ .macro killscript
.byte 0x0d
.endm
@@ -226,6 +226,18 @@
.2byte \var2
.endm
+ @ Generic compare macro which attempts to deduce argument types based on their values
+ @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
+ .macro compare arg1, arg2
+ .if ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8)
+ compare_var_to_var \arg1, \arg2
+ .elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF)
+ compare_var_to_value \arg1, \arg2
+ .else
+ .error "Invalid arguments for 'compare'"
+ .endif
+ .endm
+
@ Calls the native C function stored at `func`.
.macro callnative func
.byte 0x23
@@ -250,9 +262,16 @@
.2byte \output
.2byte SPECIAL_\function
.endm
+
+ @ temporary solution
+ .macro specialvar_ output, functionId
+ .byte 0x26
+ .2byte \output
+ .2byte \functionId
+ .endm
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
- .macro waitstate
+ .macro waitstate
.byte 0x27
.endm
@@ -288,12 +307,12 @@
.endm
@ Runs time based events. In FireRed, this command is a nop.
- .macro dodailyevents
+ .macro dodailyevents
.byte 0x2d
.endm
@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
- .macro gettime
+ .macro gettime
.byte 0x2e
.endm
@@ -304,7 +323,7 @@
.endm
@ Blocks script execution until the currently-playing sound (triggered by playse) finishes playing.
- .macro waitse
+ .macro waitse
.byte 0x30
.endm
@@ -315,7 +334,7 @@
.endm
@ Blocks script execution until all currently-playing fanfares finish.
- .macro waitfanfare
+ .macro waitfanfare
.byte 0x32
.endm
@@ -333,7 +352,7 @@
.endm
@ Crossfades the currently-playing song into the map's default song.
- .macro fadedefaultbgm
+ .macro fadedefaultbgm
.byte 0x35
.endm
@@ -441,7 +460,7 @@
.endm
@ Retrieves the number of Pokemon in the player's party, and stores that number in variable 0x800D (LASTRESULT).
- .macro getpartysize
+ .macro getpartysize
.byte 0x43
.endm
@@ -518,57 +537,58 @@
.endm
@ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open.
- .macro applymovement index, movements
- .byte 0x4f
- .2byte \index
- .4byte \movements
- .endm
-
- @ Applies the movement data at movements to the specified (index) Object on the specified (map_group, map_num) map. Really only useful if the object has followed from one map to another (e.g. Wally during the catching event).
- .macro applymovementat variable, movements, map
- .byte 0x50
- .2byte \variable
- .4byte \movements
- map \map
+ @ If no map is specified, then the current map is used.
+ .macro applymovement index, movements, map
+ .ifb \map
+ .byte 0x4f
+ .2byte \index
+ .4byte \movements
+ .else
+ @ Really only useful if the object has followed from one map to another (e.g. Wally during the catching event).
+ .byte 0x50
+ .2byte \index
+ .4byte \movements
+ map \map
+ .endif
.endm
@ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
- .macro waitmovement index
- .byte 0x51
- .2byte \index
- .endm
-
- @ Blocks script execution until the movements being applied to the specified (index) Object on the specified (map) map finish.
- .macro waitmovementat index, map
- .byte 0x52
- .2byte \index
- map \map
- .endm
-
- @ Attempts to hide the specified (index) Object on the current map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
- .macro removeobject index
- .byte 0x53
- .2byte \index
+ @ If no map is specified, then the current map is used.
+ .macro waitmovement index, map
+ .ifb \map
+ .byte 0x51
+ .2byte \index
+ .else
+ .byte 0x52
+ .2byte \index
+ map \map
+ .endif
.endm
@ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
- .macro removeobjectat index, map
- .byte 0x54
- .2byte \index
- map \map
- .endm
-
- @ Unsets the specified (index) Object's visibility flag on the current map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
- .macro addobject index
- .byte 0x55
- .2byte \index
+ @ If no map is specified, then the current map is used.
+ .macro removeobject index, map
+ .ifb \map
+ .byte 0x53
+ .2byte \index
+ .else
+ .byte 0x54
+ .2byte \index
+ map \map
+ .endif
.endm
@ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
- .macro addobjectat index, map
- .byte 0x56
- .2byte \index
- map \map
+ @ If no map is specified, then the current map is used.
+ .macro addobject index, map
+ .ifb \map
+ .byte 0x55
+ .2byte \index
+ .else
+ .byte 0x56
+ .2byte \index
+ map \map
+ .endif
.endm
@ Sets the specified (index) Object's position on the current map.
@@ -592,7 +612,7 @@
.endm
@ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on.
- .macro faceplayer
+ .macro faceplayer
.byte 0x5a
.endm
@@ -659,15 +679,17 @@
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
- .macro trainerbattlebegin
+ .macro trainerbattlebegin
.byte 0x5d
.endm
- .macro ontrainerbattleend
+ @ Goes to address after the trainerbattle command (called by the battle functions, see battle_setup.c)
+ .macro gotopostbattlescript
.byte 0x5e
.endm
- .macro ontrainerbattleendgoto
+ @ Goes to address specified in the trainerbattle command (called by the battle functions, see battle_setup.c)
+ .macro gotobeatenscript
.byte 0x5f
.endm
@@ -708,7 +730,7 @@
.endm
@ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
- .macro waitmessage
+ .macro waitmessage
.byte 0x66
.endm
@@ -719,32 +741,32 @@
.endm
@ Closes the current message box.
- .macro closemessage
+ .macro closemessage
.byte 0x68
.endm
@ Ceases movement for all Objects on-screen.
- .macro lockall
+ .macro lockall
.byte 0x69
.endm
@ If the script was called by an Object, then that Object's movement will cease.
- .macro lock
+ .macro lock
.byte 0x6a
.endm
@ Resumes normal movement for all Objects on-screen, and closes any standard message boxes that are still open.
- .macro releaseall
+ .macro releaseall
.byte 0x6b
.endm
@ If the script was called by an Object, then that Object's movement will resume. This command also closes any standard message boxes that are still open.
- .macro release
+ .macro release
.byte 0x6c
.endm
@ Blocks script execution until the player presses any key.
- .macro waitbuttonpress
+ .macro waitbuttonpress
.byte 0x6d
.endm
@@ -785,7 +807,7 @@
.endm
@ Nopped in Emerald.
- .macro drawbox
+ .macro drawbox
.byte 0x72
.endm
@@ -816,7 +838,7 @@
.endm
@ Hides all boxes displayed with drawmonpic.
- .macro erasemonpic
+ .macro erasemonpic
.byte 0x76
.endm
@@ -848,11 +870,11 @@
.2byte \species
.endm
- .macro setmonmove byte1, byte2, word
+ .macro setmonmove index, slot, move
.byte 0x7b
- .byte \byte1
- .byte \byte2
- .2byte \word
+ .byte \index
+ .byte \slot
+ .2byte \move
.endm
@ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, variable 0x800D (LASTRESULT) is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, LASTRESULT is set to 0x0006. Variable 0x8004 is also set to this Pokemon's species.
@@ -956,22 +978,22 @@
.endm
@ This allows you to choose a Pokemon to use in a contest. In FireRed, this command sets the byte at 0x03000EA8 to 0x01.
- .macro choosecontestpkmn
+ .macro choosecontestmon
.byte 0x8b
.endm
@ Starts a contest. In FireRed, this command is a nop.
- .macro startcontest
+ .macro startcontest
.byte 0x8c
.endm
@ Shows the results of a contest. In FireRed, this command is a nop.
- .macro showcontestresults
+ .macro showcontestresults
.byte 0x8d
.endm
@ Starts a contest over a link connection. In FireRed, this command is a nop.
- .macro contestlinktransfer
+ .macro contestlinktransfer
.byte 0x8e
.endm
@@ -1011,7 +1033,7 @@
.endm
@ Hides the secondary box spawned by showmoney.
- .macro hidemoneybox
+ .macro hidemoneybox
.byte 0x94
.endm
@@ -1022,10 +1044,10 @@
.byte \y
.endm
- @ Gets the price reduction for the index (word) given. In FireRed, this command is a nop.
- .macro getpricereduction word
+ @ Gets the price reduction for the index given. In FireRed, this command is a nop.
+ .macro getpricereduction index
.byte 0x96
- .2byte \word
+ .2byte \index
.endm
@ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white.
@@ -1076,13 +1098,13 @@
.endm
@ Sets which healing place the player will return to if all of the Pokemon in their party faint.
- .macro setrespawn flightspot
+ .macro setrespawn heallocation
.byte 0x9f
- .2byte \flightspot
+ .2byte \heallocation
.endm
@ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT.
- .macro checkplayergender
+ .macro checkplayergender
.byte 0xa0
.endm
@@ -1103,7 +1125,7 @@
.endm
@ Queues a weather change to the default weather for the map.
- .macro resetweather
+ .macro resetweather
.byte 0xa3
.endm
@@ -1114,7 +1136,7 @@
.endm
@ Executes the weather change queued with resetweather or setweather. The current weather will smoothly fade into the queued weather.
- .macro doweather
+ .macro doweather
.byte 0xa5
.endm
@@ -1173,7 +1195,7 @@
.endm
@ Waits for the door animation started with opendoor or closedoor to finish.
- .macro waitdooranim
+ .macro waitdooranim
.byte 0xae
.endm
@@ -1185,7 +1207,7 @@
.endm
@ Sets the door tile at (x, y) to be closed without an animation.
- .macro setdoorclosed2 x, y
+ .macro setdoorclosed x, y
.byte 0xb0
.2byte \x
.2byte \y
@@ -1201,7 +1223,7 @@
.endm
@ In FireRed and Emerald, this command is a nop.
- .macro showelevmenu
+ .macro showelevmenu
.byte 0xb2
.endm
@@ -1215,9 +1237,9 @@
.2byte \count
.endm
- .macro takecoins word
+ .macro takecoins count
.byte 0xb5
- .2byte \word
+ .2byte \count
.endm
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
@@ -1229,14 +1251,13 @@
.endm
@ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
- .macro dowildbattle
+ .macro dowildbattle
.byte 0xb7
.endm
- .macro setvaddress long, word
+ .macro setvaddress pointer
.byte 0xb8
- .4byte \long
- .2byte \word
+ .4byte \pointer
.endm
.macro vgoto pointer
@@ -1314,7 +1335,7 @@
.endm
@ Blocks script execution until cry finishes.
- .macro waitmoncry
+ .macro waitmoncry
.byte 0xc5
.endm
@@ -1338,17 +1359,17 @@
.endm
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
- .macro unloadhelp
+ .macro unloadhelp
.byte 0xc9
.endm
@ After using this command, all standard message boxes will use the signpost frame.
- .macro signmsg
+ .macro signmsg
.byte 0xca
.endm
@ Ends the effects of signmsg, returning message box frames to normal.
- .macro normalmsg
+ .macro normalmsg
.byte 0xcb
.endm
@@ -1372,7 +1393,7 @@
.endm
@ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
- .macro execram
+ .macro execram
.byte 0xcf
.endm
@@ -1403,7 +1424,7 @@
.2byte \unknown
.endm
- .macro mossdeepgym2
+ .macro mossdeepgym2
.byte 0xd4
.endm
@@ -1413,7 +1434,7 @@
.2byte \var
.endm
- .macro mossdeepgym4
+ .macro mossdeepgym4
.byte 0xd6
.endm
@@ -1425,15 +1446,15 @@
.2byte \word2
.endm
- .macro cmdD8
+ .macro cmdD8
.byte 0xd8
.endm
- .macro cmdD9
+ .macro cmdD9
.byte 0xd9
.endm
- .macro hidebox2
+ .macro hidebox2
.byte 0xda
.endm
@@ -1498,7 +1519,7 @@
.endm
.macro case condition, dest
- compare_var_to_value 0x8000, \condition
+ compare 0x8000, \condition
goto_eq \dest
.endm
diff --git a/asm/macros/m4a.inc b/asm/macros/m4a.inc
new file mode 100644
index 000000000..6c5abc09b
--- /dev/null
+++ b/asm/macros/m4a.inc
@@ -0,0 +1,13 @@
+ .macro song label, music_player, unknown
+ .4byte \label
+ .2byte \music_player
+ .2byte \unknown
+ .endm
+
+ .macro music_player info_struct, track_struct, unknown_1, unknown_2
+ .4byte \info_struct
+ .4byte \track_struct
+ .byte \unknown_1
+ .space 1
+ .2byte \unknown_2
+ .endm
diff --git a/asm/macros/map.inc b/asm/macros/map.inc
index 5367ad712..23806b4cc 100644
--- a/asm/macros/map.inc
+++ b/asm/macros/map.inc
@@ -1,38 +1,8 @@
- .macro new_map_group
- inc cur_map_group
- .set cur_map_num, 0
+ .macro map map_id
+ .byte \map_id >> 8 @ map group
+ .byte \map_id & 0xFF @ map num
.endm
- .macro map_group map_name
- .set GROUP_\map_name, cur_map_group
- .set MAP_\map_name, cur_map_num
- inc cur_map_num
- .endm
-
- .macro map map_name
- .byte GROUP_\map_name
- .byte MAP_\map_name
- .endm
-
- .macro warp_map map_name
- .byte MAP_\map_name
- .byte GROUP_\map_name
- .endm
-
- .macro heal_location map_name, x, y
- .byte GROUP_\map_name
- .byte MAP_\map_name
- .2byte \x
- .2byte \y
- .space 2
- .endm
-
- .equiv GROUP_NONE, 0x7f
- .equiv MAP_NONE, 0x7f
-
- .equiv GROUP_UNDEFINED, 0xff
- .equiv MAP_UNDEFINED, 0xff
-
.macro map_script type, address
.byte \type
.4byte \address
@@ -44,37 +14,47 @@
.4byte \address
.endm
- .macro object_event index, gfx, replacement, filler1, x, y, elevation, movement_type, radius, filler2, trainer_type, sight_radius_tree_etc, script, event_flag, filler3, filler4
- .byte \index, \gfx, \replacement, \filler1
+ .macro object_event index, gfx, replacement, x, y, elevation, movement_type, x_radius, y_radius, trainer_type, sight_radius_tree_etc, script, event_flag
+ .byte \index, \gfx, \replacement, 0
.2byte \x
.2byte \y
- .byte \elevation, \movement_type, \radius, \filler2
+ .byte \elevation, \movement_type, ((\y_radius << 4) | \x_radius), 0
.2byte \trainer_type, \sight_radius_tree_etc
.4byte \script
.2byte \event_flag
- .byte \filler3, \filler4
+ .2byte 0
inc _num_npcs
.endm
- .macro warp_def x, y, byte, warp, map
+ .macro warp_def x, y, byte, warp, map_id
.2byte \x, \y
.byte \byte, \warp
- warp_map \map
+ .byte \map_id & 0xFF @ map num
+ .byte \map_id >> 8 @ map group
inc _num_warps
.endm
- .macro coord_event x, y, byte1, byte2, word1, word2, word3, script
+ .macro coord_event x, y, elevation, trigger, index, script
.2byte \x, \y
- .byte \byte1, \byte2
- .2byte \word1, \word2, \word3
+ .byte \elevation, 0
+ .2byte \trigger, \index, 0
.4byte \script
inc _num_traps
.endm
- .macro bg_event x, y, byte, kind, word, arg6, arg7, arg8
+ .macro coord_weather_event x, y, elevation, weather
+ .2byte \x, \y
+ .byte \elevation, 0
+ .2byte \weather
+ .2byte 0, 0
+ .4byte 0
+ inc _num_traps
+ .endm
+
+ .macro bg_event x, y, elevation, kind, arg6, arg7, arg8
.2byte \x, \y
- .byte \byte, \kind
- .2byte \word
+ .byte \elevation, \kind
+ .2byte 0
.if \kind < 5
.4byte \arg6
.else
@@ -84,6 +64,14 @@
inc _num_signs
.endm
+ .macro bg_hidden_item_event x, y, height, item, flag
+ bg_event \x, \y, \height, 7, \item, \flag, 0
+ .endm
+
+ .macro bg_secret_base_event x, y, height, secret_base_id
+ bg_event \x, \y, \height, 8, \secret_base_id, 0, 0
+ .endm
+
.macro map_events npcs, warps, traps, signs
.byte _num_npcs, _num_warps, _num_traps, _num_signs
.4byte \npcs, \warps, \traps, \signs
@@ -107,7 +95,7 @@
.equiv connection_dive, 5
.equiv connection_emerge, 6
- .macro connection direction, offset, map, filler
+ .macro connection direction, offset, map
.4byte connection_\direction
.4byte \offset
map \map
diff --git a/asm/macros/movement.inc b/asm/macros/movement.inc
index 5a810c497..99b5c8f84 100644
--- a/asm/macros/movement.inc
+++ b/asm/macros/movement.inc
@@ -1,4 +1,4 @@
- .macro create_movement name
+ .macro create_movement_action name
enum _\name
.macro \name
.byte _\name
@@ -6,118 +6,126 @@
.endm
enum_start
- create_movement step_00
- create_movement step_01
- create_movement step_02
- create_movement step_03
- create_movement slow_step_down
- create_movement slow_step_up
- create_movement slow_step_left
- create_movement slow_step_right
- create_movement step_down
- create_movement step_up
- create_movement step_left
- create_movement step_right
- create_movement fast_step_down
- create_movement fast_step_up
- create_movement fast_step_left
- create_movement fast_step_right
- create_movement step_10
- create_movement step_11
- create_movement step_12
- create_movement step_13
- create_movement step_14
- create_movement step_15
- create_movement step_16
- create_movement step_17
- create_movement step_18
- create_movement step_19
- create_movement step_1a
- create_movement step_1b
- create_movement step_1c
- create_movement step_1d
- create_movement step_1e
- create_movement step_1f
- create_movement step_20
- create_movement step_21
- create_movement step_22
- create_movement step_23
- create_movement step_24
- create_movement step_25
- create_movement step_26
- create_movement step_27
- create_movement step_28
- create_movement step_29
- create_movement step_2a
- create_movement step_2b
- create_movement step_2c
- create_movement step_2d
- create_movement step_2e
- create_movement step_2f
- create_movement step_30
- create_movement step_31
- create_movement step_32
- create_movement step_33
- create_movement step_34
- create_movement step_35
- create_movement step_36
- create_movement step_37
- create_movement step_38
- create_movement step_39
- create_movement step_3a
- create_movement step_3b
- create_movement step_3c
- create_movement step_3d
- create_movement step_3e
- create_movement step_3f
- create_movement step_40
- create_movement step_41
- create_movement step_42
- create_movement step_43
- create_movement step_44
- create_movement step_45
- create_movement step_46
- create_movement step_47
- create_movement step_48
- create_movement step_49
- create_movement step_4a
- create_movement step_4b
- create_movement step_4c
- create_movement step_4d
- create_movement step_4e
- create_movement step_4f
- create_movement step_50
- create_movement step_51
- create_movement step_52
- create_movement step_53
- create_movement step_54
- create_movement step_55
- create_movement step_56
- create_movement step_57
- create_movement step_58
- create_movement step_59
- create_movement step_5a
- create_movement step_5b
- create_movement step_5c
- create_movement step_5d
- create_movement step_5e
- create_movement step_5f
- create_movement step_60
- create_movement step_61
- create_movement step_62
- create_movement step_63
+ create_movement_action face_down
+ create_movement_action face_up
+ create_movement_action face_left
+ create_movement_action face_right
+ create_movement_action walk_slow_down
+ create_movement_action walk_slow_up
+ create_movement_action walk_slow_left
+ create_movement_action walk_slow_right
+ create_movement_action walk_down
+ create_movement_action walk_up
+ create_movement_action walk_left
+ create_movement_action walk_right
+ create_movement_action jump_2_down
+ create_movement_action jump_2_up
+ create_movement_action jump_2_left
+ create_movement_action jump_2_right
+ create_movement_action delay_1
+ create_movement_action delay_2
+ create_movement_action delay_4
+ create_movement_action delay_8
+ create_movement_action delay_16
+ create_movement_action walk_fast_down
+ create_movement_action walk_fast_up
+ create_movement_action walk_fast_left
+ create_movement_action walk_fast_right
+ create_movement_action walk_in_place_slow_down
+ create_movement_action walk_in_place_slow_up
+ create_movement_action walk_in_place_slow_left
+ create_movement_action walk_in_place_slow_right
+ create_movement_action walk_in_place_down
+ create_movement_action walk_in_place_up
+ create_movement_action walk_in_place_left
+ create_movement_action walk_in_place_right
+ create_movement_action walk_in_place_fast_down
+ create_movement_action walk_in_place_fast_up
+ create_movement_action walk_in_place_fast_left
+ create_movement_action walk_in_place_fast_right
+ create_movement_action walk_in_place_fastest_down
+ create_movement_action walk_in_place_fastest_up
+ create_movement_action walk_in_place_fastest_left
+ create_movement_action walk_in_place_fastest_right
+ create_movement_action ride_water_current_down
+ create_movement_action ride_water_current_up
+ create_movement_action ride_water_current_left
+ create_movement_action ride_water_current_right
+ create_movement_action walk_fastest_down
+ create_movement_action walk_fastest_up
+ create_movement_action walk_fastest_left
+ create_movement_action walk_fastest_right
+ create_movement_action slide_down
+ create_movement_action slide_up
+ create_movement_action slide_left
+ create_movement_action slide_right
+ create_movement_action player_run_down
+ create_movement_action player_run_up
+ create_movement_action player_run_left
+ create_movement_action player_run_right
+ create_movement_action start_anim_in_direction
+ create_movement_action jump_special_down
+ create_movement_action jump_special_up
+ create_movement_action jump_special_left
+ create_movement_action jump_special_right
+ create_movement_action face_player
+ create_movement_action face_away_player
+ create_movement_action lock_facing_direction
+ create_movement_action unlock_facing_direction
+ create_movement_action jump_down
+ create_movement_action jump_up
+ create_movement_action jump_left
+ create_movement_action jump_right
+ create_movement_action jump_in_place_down
+ create_movement_action jump_in_place_up
+ create_movement_action jump_in_place_left
+ create_movement_action jump_in_place_right
+ create_movement_action jump_in_place_down_up
+ create_movement_action jump_in_place_up_down
+ create_movement_action jump_in_place_left_right
+ create_movement_action jump_in_place_right_left
+ create_movement_action face_original_direction
+ create_movement_action nurse_joy_bow
+ create_movement_action enable_jump_landing_ground_effect
+ create_movement_action disable_jump_landing_ground_effect
+ create_movement_action disable_anim
+ create_movement_action restore_anim
+ create_movement_action set_invisible
+ create_movement_action set_visible
+ create_movement_action emote_exclamation_mark
+ create_movement_action emote_question_mark
+ create_movement_action emote_heart
+ create_movement_action reveal_trainer
+ create_movement_action rock_smash_break
+ create_movement_action cut_tree
+ create_movement_action set_fixed_priority
+ create_movement_action clear_fixed_priority
+ create_movement_action init_affine_anim
+ create_movement_action clear_affine_anim
+ create_movement_action unknown_movement_1
+ create_movement_action unknown_movement_2
+ create_movement_action walk_down_start_affine
+ create_movement_action walk_down_affine
- enum_start 0x91
- create_movement step_91
- create_movement step_92
- create_movement step_93
- create_movement step_94
- create_movement step_95
- create_movement step_96
- create_movement step_97
- create_movement step_98
- create_movement step_99
- create_movement step_9A
+ enum_start 0x8C
+ create_movement_action walk_diag_northwest
+ create_movement_action walk_diag_northeast
+ create_movement_action walk_diag_southwest
+ create_movement_action walk_diag_southeast
+ create_movement_action walk_slow_diag_northwest
+ create_movement_action walk_slow_diag_northeast
+ create_movement_action walk_slow_diag_southwest
+ create_movement_action walk_slow_diag_southeast
+ create_movement_action store_lock_anim
+ create_movement_action free_unlock_anim
+ create_movement_action walk_left_affine
+ create_movement_action walk_right_affine
+ create_movement_action levitate
+ create_movement_action stop_levitate
+ create_movement_action destroy_extra_task
+ create_movement_action figure_8
+ create_movement_action fly_up
+ create_movement_action fly_down
enum_start 0xfe
- create_movement step_end
+ create_movement_action step_end
diff --git a/asm/macros/music_voice.inc b/asm/macros/music_voice.inc
new file mode 100644
index 000000000..b7a9e7f8d
--- /dev/null
+++ b/asm/macros/music_voice.inc
@@ -0,0 +1,125 @@
+ .macro voice_directsound base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
+ .byte 0
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_directsound_no_resample base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
+ .byte 8
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_directsound_alt base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
+ .byte 16
+ _voice_directsound \base_midi_key, \pan, \sample_data_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_directsound base_midi_key, pan, sample_data_pointer, attack, decay, sustain, release
+ .byte \base_midi_key
+ .byte 0
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .4byte \sample_data_pointer
+ .byte \attack
+ .byte \decay
+ .byte \sustain
+ .byte \release
+ .endm
+
+ .macro voice_square_1 sweep, duty_cycle, attack, decay, sustain, release
+ _voice_square_1 1, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_square_1_alt sweep, duty_cycle, attack, decay, sustain, release
+ _voice_square_1 9, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_square_1 type, sweep, duty_cycle, attack, decay, sustain, release
+ .byte \type, 60, 0
+ .byte \sweep
+ .byte (\duty_cycle & 0x3)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_square_2 duty_cycle, attack, decay, sustain, release
+ _voice_square_2 2, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_square_2_alt duty_cycle, attack, decay, sustain, release
+ _voice_square_2 10, \duty_cycle, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_square_2 type, duty_cycle, attack, decay, sustain, release
+ .byte \type, 60, 0, 0
+ .byte (\duty_cycle & 0x3)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_programmable_wave wave_samples_pointer, attack, decay, sustain, release
+ _voice_programmable_wave 3, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_programmable_wave_alt wave_samples_pointer, attack, decay, sustain, release
+ _voice_programmable_wave 11, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_programmable_wave type, wave_samples_pointer, attack, decay, sustain, release
+ .byte \type, 60, 0, 0
+ .4byte \wave_samples_pointer
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_noise period, attack, decay, sustain, release
+ _voice_noise 4, \period, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro voice_noise_alt period, attack, decay, sustain, release
+ _voice_noise 12, \period, \attack, \decay, \sustain, \release
+ .endm
+
+ .macro _voice_noise type, period, attack, decay, sustain, release
+ .byte \type, 60, 0, 0
+ .byte (\period & 0x1)
+ .byte 0, 0, 0
+ .byte (\attack & 0x7)
+ .byte (\decay & 0x7)
+ .byte (\sustain & 0xF)
+ .byte (\release & 0x7)
+ .endm
+
+ .macro voice_keysplit voice_group_pointer, keysplit_table_pointer
+ .byte 0x40, 0, 0, 0
+ .4byte \voice_group_pointer
+ .4byte \keysplit_table_pointer
+ .endm
+
+ .macro voice_keysplit_all voice_group_pointer
+ .byte 0x80, 0, 0, 0
+ .4byte \voice_group_pointer
+ .4byte 0
+ .endm
+
+ .macro cry sample
+ .byte 0x20, 60, 0, 0
+ .4byte \sample
+ .byte 0xff, 0, 0xff, 0
+ .endm
+
+ .macro cry2 sample
+ .byte 0x30, 60, 0, 0
+ .4byte \sample
+ .byte 0xff, 0, 0xff, 0
+ .endm
diff --git a/asm/macros/pokemon_data.inc b/asm/macros/pokemon_data.inc
index 31c015334..ce8ef98ac 100644
--- a/asm/macros/pokemon_data.inc
+++ b/asm/macros/pokemon_data.inc
@@ -52,5 +52,5 @@
.byte \max_level
.endif
- .2byte SPECIES_\species
+ .2byte \species
.endm
diff --git a/asm/macros/window.inc b/asm/macros/window.inc
index b7291138b..a91782bbf 100644
--- a/asm/macros/window.inc
+++ b/asm/macros/window.inc
@@ -8,7 +8,7 @@
.2byte \vram_tile_offset
.endm
- .macro window_template_terminator
+ .macro null_window_template
window_template 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000
.endm