2017-12-26 23:45:04 +00:00
# Battle Animation Commands
2017-12-12 18:22:19 +00:00
2018-01-01 19:08:08 +00:00
Defined in [macros/scripts/battle_anims.asm ](/macros/scripts/battle_anims.asm ) and [engine/battle_anims/anim_commands.asm:BattleAnimCommands ](/engine/battle_anims/anim_commands.asm ).
2017-12-15 00:04:44 +00:00
2018-01-17 18:58:50 +00:00
## `$00`− `$CF`: <code>anim_wait <i>length</i></code>
2017-12-29 22:47:45 +00:00
2017-12-29 23:03:35 +00:00
- *length*: duration in frames
2017-12-12 18:22:19 +00:00
2017-12-25 19:40:30 +00:00
2018-01-17 18:58:50 +00:00
## `$D0`: <code>anim_obj <i>object</i>, <i>x</i>, <i>y</i>, <i>param</i></code>
2018-01-01 23:44:08 +00:00
2018-01-17 19:53:08 +00:00
***Alternate*: < code > anim_obj < i > object< / i > , < i > x_tile< / i > , < i > x< / i > , < i > y_tile< / i > , < i > y< / i > , < i > param< / i > < / code > **
2017-12-25 19:40:30 +00:00
2017-12-29 18:38:04 +00:00
Spawns an *object* at coordinate (*x*, *y* ).
2017-12-25 19:40:30 +00:00
2017-12-29 23:03:35 +00:00
- *object*: `ANIM_OBJ` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
- *x*: the x position in pixels
2018-01-01 09:40:15 +00:00
- *y*: the y position in pixels
2017-12-29 23:03:35 +00:00
- *x_tile*: an added x position in tiles (8 pixels)
- *y_tile*: an added y position in tiles (8 pixels)
- *param*: modifies the behavior of *object* . The meaning differs for each object.
2017-12-25 19:40:30 +00:00
2018-01-01 09:40:15 +00:00
The y position also depends on the y offset defined by the object.
- *TODO: what happens for x/y values greater than 160/144 respectively? Is it 1:1 with screen coordinates?*
- *TODO: how are the x/y values mirrored when the opponent is attacking?*
- *TODO: useful positions*
- *TODO: document each object*
2017-12-25 19:40:30 +00:00
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$D1`: <code>anim_1gfx <i>gfx</i></code>
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$D2`: <code>anim_2gfx <i>gfx1</i>, <i>gfx2</i></code>
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$D3`: <code>anim_3gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i></code>
## `$D4`: <code>anim_4gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i>, <i>gfx4</i></code>
## `$D5`: <code>anim_5gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i>, <i>gfx4</i>, <i>gfx5</i></code>
2017-12-12 18:22:19 +00:00
2018-01-01 09:40:15 +00:00
Loads 1-5 sets of graphics. Will overwrite any previously loaded sets.
2017-12-29 23:03:35 +00:00
- *gfx*: `ANIM_GFX` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$D6`: <code>anim_incobj <i>object_id</i></code>
2018-01-01 09:40:15 +00:00
Increments an object's state.
- *object_id*: the nth object in order of creation
Objects are state machines. `anim_incobj` progresses the state of an object.
2018-01-17 18:58:50 +00:00
## `$D7`: <code>anim_setobj <i>object_id</i>, <i>state</i></code>
2018-01-01 09:40:15 +00:00
Sets an object's state to a specific value.
- *object_id*: the nth object in order of creation
- *state*: the state index
2017-12-12 18:22:19 +00:00
2018-01-01 09:40:15 +00:00
Objects are state machines. `anim_setobj` changes the state of an object.
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$D8`: <code>anim_incbgeffect <i>bg_effect</i></code>
2018-01-01 09:40:15 +00:00
Increments a bg effect's state.
- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
Since there can't be two of the same bg effect, the effect type is used. This is distinct from `anim_incobj` .
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
2017-12-12 18:22:19 +00:00
## `$D9`: `anim_enemyfeetobj`
2017-12-29 22:47:45 +00:00
Temporarily creates sprites from the bottom row of the enemy frontpic, so that the player backpic can be moved around without corrupting the enemy frontpic.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$DA`: `anim_playerheadobj`
2017-12-29 22:47:45 +00:00
Temporarily creates sprites from the top row of the player backpic, so that the enemy frontpic can be moved around without corrupting the player backpic.
2017-12-12 18:22:19 +00:00
## `$DB`: `anim_checkpokeball`
2018-01-01 19:08:08 +00:00
Sets `BattleAnimVar` to the result of [GetPokeBallWobble ](/engine/battle_anims/getpokeballwobble.asm ).
2017-12-29 22:47:45 +00:00
2017-12-12 18:22:19 +00:00
## `$DC`: `anim_transform`
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$DD`: `anim_raisesub`
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$DE`: `anim_dropsub`
2018-01-01 09:40:15 +00:00
2017-12-12 18:22:19 +00:00
## `$DF`: `anim_resetobp0`
2018-01-01 09:40:15 +00:00
Resets rOBP0 to the default (`q0123` or `%00011011` ).
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$E0`: <code>anim_sound <i>duration</i>, <i>tracks</i>, <i>sound_id</i></code>
2017-12-29 22:47:45 +00:00
Plays a sound.
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$E1`: <code>anim_cry <i>pitch</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Plays the user's cry.
2017-12-12 18:22:19 +00:00
## `$E2`: `anim_minimizeopp`
2018-01-01 09:40:15 +00:00
2017-12-12 18:22:19 +00:00
## `$E3`: `anim_oamon`
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$E4`: `anim_oamoff`
2017-12-29 22:47:45 +00:00
2017-12-12 18:22:19 +00:00
## `$E5`: `anim_clearobjs`
2017-12-29 22:47:45 +00:00
Removes all active objects.
2017-12-12 18:22:19 +00:00
## `$E6`: `anim_beatup`
2018-01-01 09:40:15 +00:00
2017-12-12 18:22:19 +00:00
## `$E7`: `anim_0xe7`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2017-12-12 18:22:19 +00:00
## `$E8`: `anim_updateactorpic`
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$E9`: `anim_minimize`
2018-01-01 09:40:15 +00:00
2017-12-12 18:22:19 +00:00
## `$EA`: `anim_0xea`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$EB`: `anim_0xeb`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$EC`: `anim_0xec`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$ED`: `anim_0xed`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
## `$EE`: <code>anim_if_param_and <i>value</i>, <i>address</i></code>
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$EF`: <code>anim_jumpuntil <i>address</i></code>
2017-12-12 18:22:19 +00:00
2018-01-01 09:40:15 +00:00
Jumps to another script and decrements `param` until it reaches 0. Similar to `anim_loop` .
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$F0`: <code>anim_bgeffect <i>bg_effect</i>, <i>unknown1</i>, <i>unknown2</i>, <i>unknown3</i></code>
2017-12-29 22:47:45 +00:00
2017-12-29 23:03:35 +00:00
- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
2017-12-29 22:47:45 +00:00
2017-12-12 18:22:19 +00:00
2018-01-17 18:58:50 +00:00
## `$F1`: <code>anim_bgp <i>colors</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Sets `rBGP` to *colors* .
2018-01-17 18:58:50 +00:00
## `$F2`: <code>anim_obp0 <i>colors</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Sets `rOBP0` to *colors* .
2018-01-17 18:58:50 +00:00
## `$F3`: <code>anim_obp1 <i>colors</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Sets `rOBP1` to *colors* .
2017-12-12 18:22:19 +00:00
## `$F4`: `anim_clearsprites`
2018-01-01 09:40:15 +00:00
2017-12-12 18:22:19 +00:00
## `$F5`: `anim_0xf5`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$F6`: `anim_0xf6`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$F7`: `anim_0xf7`
2018-01-01 09:40:15 +00:00
Does nothing. Unused.
2018-01-17 18:58:50 +00:00
## `$F8`: <code>anim_if_param_equal <i>value</i>, <i>address</i></code>
2017-12-12 18:22:19 +00:00
2018-01-01 19:08:08 +00:00
Jumps to another script if `wBattleAnimParam` (aka `wKickCounter` or `wPresentPower` ) is equal to *value* .
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$F9`: <code>anim_setvar <i>value</i></code>
2017-12-12 18:22:19 +00:00
2018-01-01 19:08:08 +00:00
Sets `BattleAnimVar` to *value* .
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$FA`: `anim_incvar`
2018-01-01 19:08:08 +00:00
Increments `BattleAnimVar` by 1.
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$FB`: <code>anim_if_var_equal <i>value</i>, <i>address</i></code>
2017-12-12 18:22:19 +00:00
2018-01-01 19:08:08 +00:00
Jumps to another script if `BattleAnimVar` is equal to *value* .
2017-12-29 22:47:45 +00:00
2018-01-17 18:58:50 +00:00
## `$FC`: <code>anim_jump <i>address</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Jumps to another script.
2018-01-17 18:58:50 +00:00
## `$FD`: <code>anim_loop <i>count</i>, <i>address</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Jumps to another script up to *count* times. Then does nothing, allowing execution to continue.
2018-01-17 18:58:50 +00:00
## `$FE`: <code>anim_call <i>address</i></code>
2017-12-12 18:22:19 +00:00
2017-12-29 22:47:45 +00:00
Calls a script.
2018-01-01 09:40:15 +00:00
There is no call stack. The return address is overwritten, so the maximum call depth is 1.
2018-01-17 18:58:50 +00:00
2017-12-12 18:22:19 +00:00
## `$FF`: `anim_ret`
2017-12-29 22:47:45 +00:00
2018-01-01 09:40:15 +00:00
Ends the script and returns to where it was called from. If there was no caller, the animation ends.