2017-12-31 16:28:57 +01:00
|
|
|
@ commands
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro loadspritegfx tag:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x0
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \tag
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro unloadspritegfx tag:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \tag
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro createsprite template:req, anim_battler:req, subpriority_offset:req, argv:vararg
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x02
|
|
|
|
.4byte \template
|
2018-11-13 22:19:52 +01:00
|
|
|
.if \anim_battler == ANIM_TARGET
|
2021-10-11 16:36:05 +02:00
|
|
|
.byte ANIMSPRITE_IS_TARGET | (\subpriority_offset & 0x7F)
|
2018-11-13 21:35:46 +01:00
|
|
|
.else
|
|
|
|
.byte (\subpriority_offset & 0x7F)
|
|
|
|
.endif
|
|
|
|
.byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
|
|
|
|
.Lsprite_\@_1:
|
|
|
|
.2byte \argv
|
|
|
|
.Lsprite_\@_2:
|
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro createvisualtask addr:req, priority:req, argv:vararg
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x03
|
|
|
|
.4byte \addr
|
|
|
|
.byte \priority
|
|
|
|
.byte (.Lcreatetask_\@_2 - .Lcreatetask_\@_1) / 2
|
|
|
|
.Lcreatetask_\@_1:
|
|
|
|
.2byte \argv
|
|
|
|
.Lcreatetask_\@_2:
|
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro delay frames:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x4
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \frames
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro waitforvisualfinish
|
|
|
|
.byte 0x5
|
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro nop
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x6
|
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro nop2
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x7
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro end
|
|
|
|
.byte 0x8
|
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro playse se:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x9
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro monbg battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0xa
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro clearmonbg battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0xb
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro setalpha eva:req, evb:req
|
2018-09-12 22:58:03 +02:00
|
|
|
.byte 0x0C
|
|
|
|
.2byte ((\evb) << 8) | (\eva)
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro blendoff
|
|
|
|
.byte 0xd
|
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro call ptr:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0xe
|
2021-10-04 16:21:03 +02:00
|
|
|
.4byte \ptr
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro return
|
|
|
|
.byte 0xf
|
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro setarg argId:req, value:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x10
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \argId
|
|
|
|
.2byte \value
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro choosetwoturnanim ptr1:req, ptr2:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x11
|
2021-10-04 16:21:03 +02:00
|
|
|
.4byte \ptr1
|
|
|
|
.4byte \ptr2
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro jumpifmoveturn value:req, ptr:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x12
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \value
|
2018-12-02 19:24:06 +01:00
|
|
|
.4byte \ptr
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro goto ptr:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x13
|
2018-12-02 19:24:06 +01:00
|
|
|
.4byte \ptr
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro fadetobg bg:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x14
|
2018-12-02 19:24:06 +01:00
|
|
|
.byte \bg
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro restorebg
|
|
|
|
.byte 0x15
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro waitbgfadeout
|
|
|
|
.byte 0x16
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro waitbgfadein
|
|
|
|
.byte 0x17
|
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro changebg bg:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x18
|
2018-12-02 19:24:06 +01:00
|
|
|
.byte \bg
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro playsewithpan se:req, pan:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x19
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
|
|
|
.byte \pan
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro setpan pan:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1a
|
2018-12-02 19:24:06 +01:00
|
|
|
.byte \pan
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro panse se:req, currentPan:req, targetPan:req, incrementPan:req, delay:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1b
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \currentPan
|
|
|
|
.byte \targetPan
|
|
|
|
.byte \incrementPan
|
|
|
|
.byte \delay
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2019-04-02 08:36:22 +02:00
|
|
|
.macro loopsewithpan se:req, pan:req, wait:req, times:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1c
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2019-04-02 08:36:22 +02:00
|
|
|
.byte \pan
|
|
|
|
.byte \wait
|
|
|
|
.byte \times
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2019-04-02 08:36:22 +02:00
|
|
|
.macro waitplaysewithpan se:req, pan:req, wait:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1d
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2019-04-02 08:36:22 +02:00
|
|
|
.byte \pan
|
|
|
|
.byte \wait
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro setbldcnt bldcnt:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x1e
|
2021-10-04 16:21:03 +02:00
|
|
|
.2byte \bldcnt
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro createsoundtask addr:req, argv:vararg
|
2017-12-31 16:28:57 +01:00
|
|
|
.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
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro jumpargeq argId:req, value:req, ptr:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x21
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \argId
|
|
|
|
.2byte \value
|
2018-12-02 19:24:06 +01:00
|
|
|
.4byte \ptr
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro monbg_static battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x22
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro clearmonbg_static battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x23
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro jumpifcontest ptr:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x24
|
2018-12-02 19:24:06 +01:00
|
|
|
.4byte \ptr
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro fadetobgfromset bgOpponent:req, bgPlayer:req, bgContest:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x25
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \bgOpponent
|
|
|
|
.byte \bgPlayer
|
|
|
|
.byte \bgContest
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro panse_adjustnone se:req, currentPan:req, targetPan:req, incrementPan:req, delay:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x26
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \currentPan
|
|
|
|
.byte \targetPan
|
|
|
|
.byte \incrementPan
|
|
|
|
.byte \delay
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-04 16:21:03 +02:00
|
|
|
.macro panse_adjustall se:req, currentPan:req, targetPan:req, incrementPan:req, delay:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x27
|
2018-12-02 19:24:06 +01:00
|
|
|
.2byte \se
|
2021-10-04 16:21:03 +02:00
|
|
|
.byte \currentPan
|
|
|
|
.byte \targetPan
|
|
|
|
.byte \incrementPan
|
|
|
|
.byte \delay
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro splitbgprio battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x28
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro splitbgprio_all
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x29
|
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro splitbgprio_foes battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x2a
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro invisible battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x2b
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro visible battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x2c
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro teamattack_moveback battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x2d
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
2021-10-11 16:36:05 +02:00
|
|
|
.macro teamattack_movefwd battler:req
|
2017-12-31 16:28:57 +01:00
|
|
|
.byte 0x2e
|
2018-09-01 18:36:08 +02:00
|
|
|
.byte \battler
|
2017-12-31 16:28:57 +01:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro stopsound
|
|
|
|
.byte 0x2f
|
|
|
|
.endm
|
2023-02-26 22:43:15 +01:00
|
|
|
|
2023-02-19 11:48:12 +01:00
|
|
|
@ same as createvisualtask except takes in battlerargindex, which is the battle anim arg index of the battler to loop through
|
|
|
|
.macro createvisualtaskontargets addr:req, priority:req, battlerargindex:req, argv:vararg
|
|
|
|
.byte 0x30
|
|
|
|
.4byte \addr
|
|
|
|
.byte \priority
|
|
|
|
.byte \battlerargindex
|
|
|
|
.byte (.Lcreatetask_\@_2 - .Lcreatetask_\@_1) / 2 @ num_args
|
|
|
|
.Lcreatetask_\@_1:
|
|
|
|
.2byte \argv
|
|
|
|
.Lcreatetask_\@_2:
|
|
|
|
.endm
|
2023-02-26 22:43:15 +01:00
|
|
|
|
2023-02-19 11:48:12 +01:00
|
|
|
@ same as createsprite except takes in battlerargindex, which is the battle anim arg index of the battler to loop through
|
|
|
|
.macro createspriteontargets template:req, anim_battler:req, subpriority_offset:req, battlerargindex:req, argv:vararg
|
|
|
|
.byte 0x31
|
|
|
|
.4byte \template
|
|
|
|
.if \anim_battler == ANIM_TARGET
|
|
|
|
.byte 0x80 | (\subpriority_offset & 0x7F)
|
|
|
|
.else
|
|
|
|
.byte (\subpriority_offset & 0x7F)
|
|
|
|
.endif
|
|
|
|
.byte \battlerargindex
|
|
|
|
.byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
|
|
|
|
.Lsprite_\@_1:
|
|
|
|
.2byte \argv
|
|
|
|
.Lsprite_\@_2:
|
|
|
|
.endm
|
2023-02-26 22:43:15 +01:00
|
|
|
|
2023-02-19 11:48:12 +01:00
|
|
|
@ does not overwrite gBattleAnimArgs[battlerargindex], some sprite templates are too dependent on the value (e.g. heal block)
|
|
|
|
.macro createspriteontargets_onpos template:req, anim_battler:req, subpriority_offset:req, battlerargindex:req, argv:vararg
|
|
|
|
.byte 0x32
|
|
|
|
.4byte \template
|
|
|
|
.if \anim_battler == ANIM_TARGET
|
|
|
|
.byte 0x80 | (\subpriority_offset & 0x7F)
|
|
|
|
.else
|
|
|
|
.byte (\subpriority_offset & 0x7F)
|
|
|
|
.endif
|
|
|
|
.byte \battlerargindex
|
|
|
|
.byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
|
|
|
|
.Lsprite_\@_1:
|
|
|
|
.2byte \argv
|
|
|
|
.Lsprite_\@_2:
|
|
|
|
.endm
|
2022-09-11 20:14:49 +02:00
|
|
|
|
2018-09-10 21:19:19 +02:00
|
|
|
@ useful macros
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro jumpreteq value:req, ptr:req
|
2018-09-10 21:19:19 +02:00
|
|
|
jumpargeq ARG_RET_ID, \value, \ptr
|
|
|
|
.endm
|
2022-09-11 20:14:49 +02:00
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro jumprettrue ptr:req
|
2018-09-10 21:19:19 +02:00
|
|
|
jumpreteq TRUE, \ptr
|
|
|
|
.endm
|
2022-09-11 20:14:49 +02:00
|
|
|
|
2018-12-02 19:24:06 +01:00
|
|
|
.macro jumpretfalse ptr:req
|
2018-09-10 21:19:19 +02:00
|
|
|
jumpreteq FALSE, \ptr
|
|
|
|
.endm
|
2022-09-13 21:26:36 +02:00
|
|
|
|
2019-04-01 14:43:18 +02:00
|
|
|
.macro jumpifdoublebattle ptr:req
|
|
|
|
createvisualtask AnimTask_IsDoubleBattle, 0
|
|
|
|
jumprettrue \ptr
|
|
|
|
.endm
|