2017-12-26 15:45:04 -08:00
# Battle Animation Commands
2017-12-12 10:22:19 -08:00
2018-01-01 11:08:08 -08: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-14 16:04:44 -08:00
2017-12-29 14:47:45 -08:00
## `$00`− `$CF`: `anim_wait` *length*
2017-12-29 15:03:35 -08:00
- *length*: duration in frames
2017-12-12 10:22:19 -08:00
2017-12-25 11:40:30 -08:00
2017-12-29 10:38:04 -08:00
## `$D0`: `anim_obj` *object*, *x*, *y*, *param*
2018-01-01 15:44:08 -08:00
***Alternate*: `anim_obj` *object* , *x_tile* , *x* , *y_tile* , *y* , *param* **
2017-12-25 11:40:30 -08:00
2017-12-29 10:38:04 -08:00
Spawns an *object* at coordinate (*x*, *y* ).
2017-12-25 11:40:30 -08:00
2017-12-29 15:03:35 -08: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 01:40:15 -08:00
- *y*: the y position in pixels
2017-12-29 15:03:35 -08: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 11:40:30 -08:00
2018-01-01 01:40:15 -08: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 11:40:30 -08:00
2017-12-12 10:22:19 -08:00
## `$D1`: `anim_1gfx` *gfx*
## `$D2`: `anim_2gfx` *gfx1*, *gfx2*
## `$D3`: `anim_3gfx` *gfx1*, *gfx2*, *gfx3*
## `$D4`: `anim_4gfx` *gfx1*, *gfx2*, *gfx3*, *gfx4*
## `$D5`: `anim_5gfx` *gfx1*, *gfx2*, *gfx3*, *gfx4*, *gfx5*
2018-01-01 01:40:15 -08:00
Loads 1-5 sets of graphics. Will overwrite any previously loaded sets.
2017-12-29 15:03:35 -08:00
- *gfx*: `ANIM_GFX` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
2017-12-29 14:47:45 -08:00
2018-01-01 01:40:15 -08:00
## `$D6`: `anim_incobj` *object_id*
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.
## `$D7`: `anim_setobj` *object_id*, *state*
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 10:22:19 -08:00
2018-01-01 01:40:15 -08:00
Objects are state machines. `anim_setobj` changes the state of an object.
2017-12-12 10:22:19 -08:00
2018-01-01 01:40:15 -08:00
## `$D8`: `anim_incbgeffect` *bg_effect*
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 10:22:19 -08:00
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$D9`: `anim_enemyfeetobj`
2017-12-29 14:47:45 -08: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.
2017-12-12 10:22:19 -08:00
## `$DA`: `anim_playerheadobj`
2017-12-29 14:47:45 -08: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 10:22:19 -08:00
## `$DB`: `anim_checkpokeball`
2018-01-01 11:08:08 -08:00
Sets `BattleAnimVar` to the result of [GetPokeBallWobble ](/engine/battle_anims/getpokeballwobble.asm ).
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$DC`: `anim_transform`
## `$DD`: `anim_raisesub`
## `$DE`: `anim_dropsub`
2018-01-01 01:40:15 -08:00
2017-12-12 10:22:19 -08:00
## `$DF`: `anim_resetobp0`
2018-01-01 01:40:15 -08:00
Resets rOBP0 to the default (`q0123` or `%00011011` ).
2017-12-29 14:47:45 -08:00
## `$E0`: `anim_sound` *duration*, *tracks*, *sound_id*
Plays a sound.
2017-12-12 10:22:19 -08:00
## `$E1`: `anim_cry` *pitch*
2017-12-29 14:47:45 -08:00
Plays the user's cry.
2017-12-12 10:22:19 -08:00
## `$E2`: `anim_minimizeopp`
2018-01-01 01:40:15 -08:00
2017-12-12 10:22:19 -08:00
## `$E3`: `anim_oamon`
## `$E4`: `anim_oamoff`
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$E5`: `anim_clearobjs`
2017-12-29 14:47:45 -08:00
Removes all active objects.
2017-12-12 10:22:19 -08:00
## `$E6`: `anim_beatup`
2018-01-01 01:40:15 -08:00
2017-12-12 10:22:19 -08:00
## `$E7`: `anim_0xe7`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$E8`: `anim_updateactorpic`
## `$E9`: `anim_minimize`
2018-01-01 01:40:15 -08:00
2017-12-12 10:22:19 -08:00
## `$EA`: `anim_0xea`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$EB`: `anim_0xeb`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$EC`: `anim_0xec`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$ED`: `anim_0xed`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$EE`: `anim_if_param_and` *value*, *address*
## `$EF`: `anim_jumpuntil` *address*
2018-01-01 01:40:15 -08:00
Jumps to another script and decrements `param` until it reaches 0. Similar to `anim_loop` .
2017-12-29 14:47:45 -08:00
## `$F0`: `anim_bgeffect` *bg_effect*, *unknown1*, *unknown2*, *unknown3*
2017-12-29 15:03:35 -08:00
- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm ](/constants/battle_anim_constants.asm ))
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$F1`: `anim_bgp` *colors*
2017-12-29 14:47:45 -08:00
Sets `rBGP` to *colors* .
2017-12-12 10:22:19 -08:00
## `$F2`: `anim_obp0` *colors*
2017-12-29 14:47:45 -08:00
Sets `rOBP0` to *colors* .
2017-12-12 10:22:19 -08:00
## `$F3`: `anim_obp1` *colors*
2017-12-29 14:47:45 -08:00
Sets `rOBP1` to *colors* .
2017-12-12 10:22:19 -08:00
## `$F4`: `anim_clearsprites`
2018-01-01 01:40:15 -08:00
2017-12-12 10:22:19 -08:00
## `$F5`: `anim_0xf5`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$F6`: `anim_0xf6`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$F7`: `anim_0xf7`
2018-01-01 01:40:15 -08:00
Does nothing. Unused.
2017-12-12 10:22:19 -08:00
## `$F8`: `anim_if_param_equal` *value*, *address*
2018-01-01 11:08:08 -08:00
Jumps to another script if `wBattleAnimParam` (aka `wKickCounter` or `wPresentPower` ) is equal to *value* .
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$F9`: `anim_setvar` *value*
2018-01-01 11:08:08 -08:00
Sets `BattleAnimVar` to *value* .
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$FA`: `anim_incvar`
2018-01-01 11:08:08 -08:00
Increments `BattleAnimVar` by 1.
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$FB`: `anim_if_var_equal` *value*, *address*
2018-01-01 11:08:08 -08:00
Jumps to another script if `BattleAnimVar` is equal to *value* .
2017-12-29 14:47:45 -08:00
2017-12-12 10:22:19 -08:00
## `$FC`: `anim_jump` *address*
2017-12-29 14:47:45 -08:00
Jumps to another script.
2017-12-12 10:22:19 -08:00
## `$FD`: `anim_loop` *count*, *address*
2017-12-29 14:47:45 -08:00
Jumps to another script up to *count* times. Then does nothing, allowing execution to continue.
2017-12-12 10:22:19 -08:00
## `$FE`: `anim_call` *address*
2017-12-29 14:47:45 -08:00
Calls a script.
2018-01-01 01:40:15 -08:00
There is no call stack. The return address is overwritten, so the maximum call depth is 1.
2017-12-12 10:22:19 -08:00
## `$FF`: `anim_ret`
2017-12-29 14:47:45 -08:00
2018-01-01 01:40:15 -08:00
Ends the script and returns to where it was called from. If there was no caller, the animation ends.