summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/battle_anim_commands.md78
-rw-r--r--docs/bugs_and_glitches.md12
-rw-r--r--docs/design_flaws.md10
-rw-r--r--docs/event_commands.md256
-rw-r--r--docs/images/hp_exp_bar_border.pngbin125 -> 116 bytes
-rw-r--r--docs/images/hp_exp_bar_border_fix.pngbin124 -> 187 bytes
-rw-r--r--docs/images/port.pngbin1055 -> 1048 bytes
-rw-r--r--docs/images/port_fix.pngbin1056 -> 1547 bytes
-rw-r--r--docs/map_scripts.md141
-rw-r--r--docs/menu.md299
-rw-r--r--docs/move_effect_commands.md2
-rw-r--r--docs/movement_commands.md40
-rw-r--r--docs/music_commands.md110
-rw-r--r--docs/pic_animations.md6
-rw-r--r--docs/text_commands.md37
15 files changed, 699 insertions, 292 deletions
diff --git a/docs/battle_anim_commands.md b/docs/battle_anim_commands.md
index e7eb4a98f..bd40e8a6d 100644
--- a/docs/battle_anim_commands.md
+++ b/docs/battle_anim_commands.md
@@ -3,13 +3,14 @@
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).
-## `$00`−`$CF`: `anim_wait` *length*
+## `$00`−`$CF`: <code>anim_wait <i>length</i></code>
- *length*: duration in frames
-## `$D0`: `anim_obj` *object*, *x*, *y*, *param*
-*Alternate*: `anim_obj` *object*, *x_tile*, *x*, *y_tile*, *y*, *param*
+## `$D0`: <code>anim_obj <i>object</i>, <i>x</i>, <i>y</i>, <i>param</i></code>
+
+***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>**
Spawns an *object* at coordinate (*x*, *y*).
@@ -28,22 +29,26 @@ The y position also depends on the y offset defined by the object.
- *TODO: document each object*
-## `$D1`: `anim_1gfx` *gfx*
+## `$D1`: <code>anim_1gfx <i>gfx</i></code>
+
+
+## `$D2`: <code>anim_2gfx <i>gfx1</i>, <i>gfx2</i></code>
+
-## `$D2`: `anim_2gfx` *gfx1*, *gfx2*
+## `$D3`: <code>anim_3gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i></code>
-## `$D3`: `anim_3gfx` *gfx1*, *gfx2*, *gfx3*
-## `$D4`: `anim_4gfx` *gfx1*, *gfx2*, *gfx3*, *gfx4*
+## `$D4`: <code>anim_4gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i>, <i>gfx4</i></code>
-## `$D5`: `anim_5gfx` *gfx1*, *gfx2*, *gfx3*, *gfx4*, *gfx5*
+
+## `$D5`: <code>anim_5gfx <i>gfx1</i>, <i>gfx2</i>, <i>gfx3</i>, <i>gfx4</i>, <i>gfx5</i></code>
Loads 1-5 sets of graphics. Will overwrite any previously loaded sets.
- *gfx*: `ANIM_GFX` constants (see [constants/battle_anim_constants.asm](/constants/battle_anim_constants.asm))
-## `$D6`: `anim_incobj` *object_id*
+## `$D6`: <code>anim_incobj <i>object_id</i></code>
Increments an object's state.
@@ -51,7 +56,8 @@ Increments an object's state.
Objects are state machines. `anim_incobj` progresses the state of an object.
-## `$D7`: `anim_setobj` *object_id*, *state*
+
+## `$D7`: <code>anim_setobj <i>object_id</i>, <i>state</i></code>
Sets an object's state to a specific value.
@@ -60,7 +66,8 @@ Sets an object's state to a specific value.
Objects are state machines. `anim_setobj` changes the state of an object.
-## `$D8`: `anim_incbgeffect` *bg_effect*
+
+## `$D8`: <code>anim_incbgeffect <i>bg_effect</i></code>
Increments a bg effect's state.
@@ -73,6 +80,7 @@ Since there can't be two of the same bg effect, the effect type is used. This is
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.
+
## `$DA`: `anim_playerheadobj`
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.
@@ -85,8 +93,10 @@ Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/g
## `$DC`: `anim_transform`
+
## `$DD`: `anim_raisesub`
+
## `$DE`: `anim_dropsub`
@@ -95,11 +105,12 @@ Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/g
Resets rOBP0 to the default (`q0123` or `%00011011`).
-## `$E0`: `anim_sound` *duration*, *tracks*, *sound_id*
+## `$E0`: <code>anim_sound <i>duration</i>, <i>tracks</i>, <i>sound_id</i></code>
Plays a sound.
-## `$E1`: `anim_cry` *pitch*
+
+## `$E1`: <code>anim_cry <i>pitch</i></code>
Plays the user's cry.
@@ -109,6 +120,7 @@ Plays the user's cry.
## `$E3`: `anim_oamon`
+
## `$E4`: `anim_oamoff`
@@ -127,6 +139,7 @@ Does nothing. Unused.
## `$E8`: `anim_updateactorpic`
+
## `$E9`: `anim_minimize`
@@ -134,40 +147,46 @@ Does nothing. Unused.
Does nothing. Unused.
+
## `$EB`: `anim_0xeb`
Does nothing. Unused.
+
## `$EC`: `anim_0xec`
Does nothing. Unused.
+
## `$ED`: `anim_0xed`
Does nothing. Unused.
-## `$EE`: `anim_if_param_and` *value*, *address*
+## `$EE`: <code>anim_if_param_and <i>value</i>, <i>address</i></code>
-## `$EF`: `anim_jumpuntil` *address*
+
+## `$EF`: <code>anim_jumpuntil <i>address</i></code>
Jumps to another script and decrements `param` until it reaches 0. Similar to `anim_loop`.
-## `$F0`: `anim_bgeffect` *bg_effect*, *unknown1*, *unknown2*, *unknown3*
+## `$F0`: <code>anim_bgeffect <i>bg_effect</i>, <i>unknown1</i>, <i>unknown2</i>, <i>unknown3</i></code>
- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm](/constants/battle_anim_constants.asm))
-## `$F1`: `anim_bgp` *colors*
+## `$F1`: <code>anim_bgp <i>colors</i></code>
Sets `rBGP` to *colors*.
-## `$F2`: `anim_obp0` *colors*
+
+## `$F2`: <code>anim_obp0 <i>colors</i></code>
Sets `rOBP0` to *colors*.
-## `$F3`: `anim_obp1` *colors*
+
+## `$F3`: <code>anim_obp1 <i>colors</i></code>
Sets `rOBP1` to *colors*.
@@ -179,45 +198,54 @@ Sets `rOBP1` to *colors*.
Does nothing. Unused.
+
## `$F6`: `anim_0xf6`
Does nothing. Unused.
+
## `$F7`: `anim_0xf7`
Does nothing. Unused.
-## `$F8`: `anim_if_param_equal` *value*, *address*
+## `$F8`: <code>anim_if_param_equal <i>value</i>, <i>address</i></code>
Jumps to another script if `wBattleAnimParam` (aka `wKickCounter` or `wPresentPower`) is equal to *value*.
-## `$F9`: `anim_setvar` *value*
+
+## `$F9`: <code>anim_setvar <i>value</i></code>
Sets `BattleAnimVar` to *value*.
+
## `$FA`: `anim_incvar`
Increments `BattleAnimVar` by 1.
-## `$FB`: `anim_if_var_equal` *value*, *address*
+
+## `$FB`: <code>anim_if_var_equal <i>value</i>, <i>address</i></code>
Jumps to another script if `BattleAnimVar` is equal to *value*.
-## `$FC`: `anim_jump` *address*
+
+## `$FC`: <code>anim_jump <i>address</i></code>
Jumps to another script.
-## `$FD`: `anim_loop` *count*, *address*
+
+## `$FD`: <code>anim_loop <i>count</i>, <i>address</i></code>
Jumps to another script up to *count* times. Then does nothing, allowing execution to continue.
-## `$FE`: `anim_call` *address*
+
+## `$FE`: <code>anim_call <i>address</i></code>
Calls a script.
There is no call stack. The return address is overwritten, so the maximum call depth is 1.
+
## `$FF`: `anim_ret`
Ends the script and returns to where it was called from. If there was no caller, the animation ends.
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 52d788987..5abf9d08a 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -567,7 +567,7 @@ This is a bug with `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2
```asm
Text_ABoostedStringBuffer2ExpPoints::
- text ""
+ text_start
line "a boosted"
cont "@"
deciram StringBuffer2, 2, 4
@@ -575,7 +575,7 @@ Text_ABoostedStringBuffer2ExpPoints::
prompt
Text_StringBuffer2ExpPoints::
- text ""
+ text_start
line "@"
deciram StringBuffer2, 2, 4
text " EXP. Points!"
@@ -746,7 +746,7 @@ Data_DaisyMassage: ; 746b
CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, StringBuffer1
ld de, StringBuffer3
- ld bc, PKMN_NAME_LENGTH
+ ld bc, MON_NAME_LENGTH
jp CopyBytes
```
@@ -993,7 +993,7 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](
([Video](https://www.youtube.com/watch?v=z305e4sIO24))
-The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex.asm](/engine/pokedex.asm):
+The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm):
```asm
.Cry: ; 40340
@@ -1002,7 +1002,7 @@ The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActi
call GetCryIndex
ld e, c
ld d, b
- call PlayCryHeader
+ call PlayCry
ret
```
@@ -1011,7 +1011,7 @@ The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActi
```asm
.Cry: ; 40340
ld a, [CurPartySpecies]
- call PlayCry
+ call PlayMonCry
ret
```
diff --git a/docs/design_flaws.md b/docs/design_flaws.md
index 21a222743..7dc4d13db 100644
--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -24,7 +24,7 @@ dba_pic: MACRO ; dbw bank, address
ENDM
```
-The offset is translated into a correct bank by `FixPicBank` in [gfx/load_pics.asm](/gfx/load_pics.asm):
+The offset is translated into a correct bank by `FixPicBank` in [engine/load_pics.asm](/engine/load_pics.asm):
```asm
FixPicBank: ; 511c5
@@ -106,7 +106,7 @@ ROMX $49
"Pics 2"
```
-Two routines in [gfx/load_pics.asm](/gfx/load_pics.asm) make this assumption; `GetFrontpicPointer`:
+Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`:
```asm
ld a, [CurPartySpecies]
@@ -228,7 +228,7 @@ INCBIN "gfx/footprints/wartortle.1bpp", footprint_bottom
...
```
-`Pokedex_LoadAnyFootprint` in [engine/pokedex.asm](/engine/pokedex.asm):
+`Pokedex_LoadAnyFootprint` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm):
```asm
push hl
@@ -282,7 +282,7 @@ Modify `Pokedex_LoadAnyFootprint`:
`PokedexDataPointerTable` in [data/pokemon/dex_entry_pointers.asm](/data/pokemon/dex_entry_pointers.asm) is a table of `dw`, not `dba`, yet there are four banks used for Pokédex entries. The correct bank is derived from the species ID at the beginning of each Pokémon's base stats. (This is the only use the base stat species ID has.)
-Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex_2.asm](/engine/pokedex_2.asm):
+Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
```asm
GetDexEntryPointer: ; 44333
@@ -471,7 +471,7 @@ GetNumberedTMHM: ; d417
## `GetForestTreeFrame` works, but it's still bad
-In [tilesets/animations.asm](/tilesets/animations.asm):
+In [engine/tileset_anims.asm](/engine/tileset_anims.asm):
```asm
GetForestTreeFrame: ; fc54c
diff --git a/docs/event_commands.md b/docs/event_commands.md
index b4314bd24..91486ad06 100644
--- a/docs/event_commands.md
+++ b/docs/event_commands.md
@@ -3,147 +3,147 @@
Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/scripting.asm:ScriptCommandTable](/engine/scripting.asm).
-## `$00`: `scall` *script*
+## `$00`: <code>scall <i>script</i></code>
-## `$01`: `farscall` *script*
+## `$01`: <code>farscall <i>script</i></code>
-## `$02`: `ptcall` *script*
+## `$02`: <code>ptcall <i>script</i></code>
-## `$03`: `jump` *script*
+## `$03`: <code>jump <i>script</i></code>
-## `$04`: `farjump` *script*
+## `$04`: <code>farjump <i>script</i></code>
-## `$05`: `ptjump` *script*
+## `$05`: <code>ptjump <i>script</i></code>
-## `$06`: `if_equal` *byte*, *script*
+## `$06`: <code>if_equal <i>byte</i>, <i>script</i></code>
-## `$07`: `if_not_equal` *byte*, *script*
+## `$07`: <code>if_not_equal <i>byte</i>, <i>script</i></code>
-## `$08`: `iffalse` *script*
+## `$08`: <code>iffalse <i>script</i></code>
-## `$09`: `iftrue` *script*
+## `$09`: <code>iftrue <i>script</i></code>
-## `$0A`: `if_greater_than` *byte*, *script*
+## `$0A`: <code>if_greater_than <i>byte</i>, <i>script</i></code>
-## `$0B`: `if_less_than` *byte*, *script*
+## `$0B`: <code>if_less_than <i>byte</i>, <i>script</i></code>
-## `$0C`: `jumpstd` *std_script*
+## `$0C`: <code>jumpstd <i>std_script</i></code>
-## `$0D`: `callstd` *std_script*
+## `$0D`: <code>callstd <i>std_script</i></code>
-## `$0E`: `callasm` *asm*
+## `$0E`: <code>callasm <i>asm</i></code>
-## `$0F`: `special` *special_pointer*
+## `$0F`: <code>special <i>special_pointer</i></code>
-## `$10`: `ptcallasm` *asm*
+## `$10`: <code>ptcallasm <i>asm</i></code>
-## `$11`: `checkmapscene` *map*
+## `$11`: <code>checkmapscene <i>map</i></code>
-## `$12`: `setmapscene` *map*, *scene_id*
+## `$12`: <code>setmapscene <i>map</i>, <i>scene_id</i></code>
## `$13`: `checkscene`
-## `$14`: `setscene` *scene_id*
+## `$14`: <code>setscene <i>scene_id</i></code>
-## `$15`: `writebyte` *value*
+## `$15`: <code>writebyte <i>value</i></code>
-## `$16`: `addvar` *value*
+## `$16`: <code>addvar <i>value</i></code>
-## `$17`: `random` *value*
+## `$17`: <code>random <i>value</i></code>
## `$18`: `checkver`
-## `$19`: `copybytetovar` *address*
+## `$19`: <code>copybytetovar <i>address</i></code>
-## `$1A`: `copyvartobyte` *address*
+## `$1A`: <code>copyvartobyte <i>address</i></code>
-## `$1B`: `loadvar` *address*, *value*
+## `$1B`: <code>loadvar <i>address</i>, <i>value</i></code>
-## `$1C`: `checkcode` *variable*
+## `$1C`: <code>checkcode <i>variable</i></code>
-## `$1D`: `writevarcode` *variable*
+## `$1D`: <code>writevarcode <i>variable</i></code>
-## `$1E`: `writecode` *variable*, *value*
+## `$1E`: <code>writecode <i>variable</i>, <i>value</i></code>
-## `$1F`: `giveitem` *item_id*[, *quantity*=1]
+## `$1F`: <code>giveitem <i>item_id</i>[, <i>quantity</i>=1]</code>
-## `$20`: `takeitem` *item_id*[, *quantity*=1]
+## `$20`: <code>takeitem <i>item_id</i>[, <i>quantity</i>=1]</code>
-## `$21`: `checkitem` *item_id*
+## `$21`: <code>checkitem <i>item_id</i></code>
-## `$22`: `givemoney` *account*, *value*
+## `$22`: <code>givemoney <i>account</i>, <i>value</i></code>
-## `$23`: `takemoney` *account*, *value*
+## `$23`: <code>takemoney <i>account</i>, <i>value</i></code>
-## `$24`: `checkmoney` *account*, *value*
+## `$24`: <code>checkmoney <i>account</i>, <i>value</i></code>
-## `$25`: `givecoins` *value*
+## `$25`: <code>givecoins <i>value</i></code>
-## `$26`: `takecoins` *value*
+## `$26`: <code>takecoins <i>value</i></code>
-## `$27`: `checkcoins` *value*
+## `$27`: <code>checkcoins <i>value</i></code>
-## `$28`: `addcellnum` *contact_id*
+## `$28`: <code>addcellnum <i>contact_id</i></code>
-## `$29`: `delcellnum` *contact_id*
+## `$29`: <code>delcellnum <i>contact_id</i></code>
-## `$2A`: `checkcellnum` *contact_id*
+## `$2A`: <code>checkcellnum <i>contact_id</i></code>
-## `$2B`: `checktime` *time*
+## `$2B`: <code>checktime <i>time</i></code>
- **`checkmorn`:** `checktime MORN`
- **`checkday`:** `checktime DAY`
- **`checknite`:** `checktime NITE`
-## `$2C`: `checkpoke` *mon_id*
+## `$2C`: <code>checkpoke <i>mon_id</i></code>
-## `$2D`: `givepoke` *mon_id*, *level*[, *item*=0[, *trainer*=0, *ot_name*, *nickname*]]
+## `$2D`: <code>givepoke <i>mon_id</i>, <i>level</i>[, <i>item</i>=0[, <i>trainer</i>=0, <i>ot_name</i>, <i>nickname</i>]]</code>
-## `$2E`: `giveegg` *mon_id*, *level*
+## `$2E`: <code>giveegg <i>mon_id</i>, <i>level</i></code>
-## `$2F`: `givepokeitem` *pointer*
+## `$2F`: <code>givepokeitem <i>pointer</i></code>
-## `$30`: `checkpokeitem` *pointer*
+## `$30`: <code>checkpokeitem <i>pointer</i></code>
-## `$31`: `checkevent` *event_flag*
+## `$31`: <code>checkevent <i>event_flag</i></code>
-## `$32`: `clearevent` *event_flag*
+## `$32`: <code>clearevent <i>event_flag</i></code>
-## `$33`: `setevent` *event_flag*
+## `$33`: <code>setevent <i>event_flag</i></code>
-## `$34`: `checkflag` *engine_flag*
+## `$34`: <code>checkflag <i>engine_flag</i></code>
-## `$35`: `clearflag` *engine_flag*
+## `$35`: <code>clearflag <i>engine_flag</i></code>
-## `$36`: `setflag` *engine_flag*
+## `$36`: <code>setflag <i>engine_flag</i></code>
## `$37`: `wildon`
## `$38`: `wildoff`
-## `$39`: `xycompare` *pointer*
+## `$39`: <code>xycompare <i>pointer</i></code>
-## `$3A`: `warpmod` *warp_id*, *map*
+## `$3A`: <code>warpmod <i>warp_id</i>, <i>map</i></code>
-## `$3B`: `blackoutmod` *map*
+## `$3B`: <code>blackoutmod <i>map</i></code>
-## `$3C`: `warp` *map*, *x*, *y*
+## `$3C`: <code>warp <i>map</i>, <i>x</i>, <i>y</i></code>
-## `$3D`: `readmoney` *account*, *memory*
+## `$3D`: <code>readmoney <i>account</i>, <i>memory</i></code>
-## `$3E`: `readcoins` *memory*
+## `$3E`: <code>readcoins <i>memory</i></code>
-## `$3F`: `RAM2MEM` *memory*
+## `$3F`: <code>vartomem <i>memory</i></code>
-## `$40`: `pokenamemem` *mon_id*, *memory*
+## `$40`: <code>pokenamemem <i>mon_id</i>, <i>memory</i></code>
-## `$41`: `itemtotext` *item_id*, *memory*
+## `$41`: <code>itemtotext <i>item_id</i>, <i>memory</i></code>
-## `$42`: `mapnametotext` *memory*
+## `$42`: <code>mapnametotext <i>memory</i></code>
-## `$43`: `trainertotext` *trainer_id*, *trainer_group*, *memory*
+## `$43`: <code>trainertotext <i>trainer_id</i>, <i>trainer_group</i>, <i>memory</i></code>
-## `$44`: `stringtotext` *text_pointer*, *memory*
+## `$44`: <code>stringtotext <i>text_pointer</i>, <i>memory</i></code>
## `$45`: `itemnotify`
@@ -151,35 +151,35 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s
## `$47`: `opentext`
-## `$48`: `refreshscreen` *dummy*
+## `$48`: <code>refreshscreen [<i>dummy</i>=0]</code>
## `$49`: `closetext`
-## `$4A`: `loadbytec2cf` *byte*
+## `$4A`: <code>loadbytec2cf <i>byte</i></code>
-## `$4B`: `farwritetext` *text_pointer*
+## `$4B`: <code>farwritetext <i>text_pointer</i></code>
-## `$4C`: `writetext` *text_pointer*
+## `$4C`: <code>writetext <i>text_pointer</i></code>
-## `$4D`: `repeattext` *byte1*, *byte2*
+## `$4D`: <code>repeattext <i>byte1</i>, <i>byte2</i></code>
## `$4E`: `yesorno`
-## `$4F`: `loadmenudata` *data_pointer*
+## `$4F`: <code>loadmenudata <i>data_pointer</i></code>
## `$50`: `closewindow`
-## `$51`: `jumptextfaceplayer` *text_pointer*
+## `$51`: <code>jumptextfaceplayer <i>text_pointer</i></code>
-## `$52`: `farjumptext` *text_pointer*
+## `$52`: <code>farjumptext <i>text_pointer</i></code>
-## `$53`: `jumptext` *text_pointer*
+## `$53`: <code>jumptext <i>text_pointer</i></code>
## `$54`: `waitbutton`
## `$55`: `buttonsound`
-## `$56`: `pokepic` *mon_id*
+## `$56`: <code>pokepic <i>mon_id</i></code>
## `$57`: `closepokepic`
@@ -193,21 +193,21 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s
## `$5C`: `loadmemtrainer`
-## `$5D`: `loadwildmon` *mon_id*, *level*
+## `$5D`: <code>loadwildmon <i>mon_id</i>, <i>level</i></code>
-## `$5E`: `loadtrainer` *trainer_group*, *trainer_id*
+## `$5E`: <code>loadtrainer <i>trainer_group</i>, <i>trainer_id</i></code>
## `$5F`: `startbattle`
## `$60`: `reloadmapafterbattle`
-## `$61`: `catchtutorial` *byte*
+## `$61`: <code>catchtutorial <i>byte</i></code>
-## `$62`: `trainertext` *which_text*
+## `$62`: <code>trainertext <i>which_text</i></code>
-## `$63`: `trainerflagaction` *action*
+## `$63`: <code>trainerflagaction <i>action</i></code>
-## `$64`: `winlosstext` *win_text_pointer*, *loss_text_pointer*
+## `$64`: <code>winlosstext <i>win_text_pointer</i>, <i>loss_text_pointer</i></code>
## `$65`: `scripttalkafter`
@@ -215,65 +215,65 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s
## `$67`: `check_just_battled`
-## `$68`: `setlasttalked` *object_id*
+## `$68`: <code>setlasttalked <i>object_id</i></code>
-## `$69`: `applymovement` *object_id*, *data_pointer*
+## `$69`: <code>applymovement <i>object_id</i>, <i>data_pointer</i></code>
-## `$6A`: `applymovement2` *data_pointer*
+## `$6A`: <code>applymovement2 <i>data_pointer</i></code>
## `$6B`: `faceplayer`
-## `$6C`: `faceobject` *object1*, *object2*
+## `$6C`: <code>faceobject <i>object1</i>, <i>object2</i></code>
-## `$6D`: `variablesprite` *variable_sprite_id*, *sprite_id*
+## `$6D`: <code>variablesprite <i>variable_sprite_id</i>, <i>sprite_id</i></code>
-## `$6E`: `disappear` *object_id*
+## `$6E`: <code>disappear <i>object_id</i></code>
-## `$6F`: `appear` *object_id*
+## `$6F`: <code>appear <i>object_id</i></code>
-## `$70`: `follow` *object2*, *object1*
+## `$70`: <code>follow <i>object2</i>, <i>object1</i></code>
## `$71`: `stopfollow`
-## `$72`: `moveobject` *object_id*, *x*, *y*
+## `$72`: <code>moveobject <i>object_id</i>, <i>x</i>, <i>y</i></code>
-## `$73`: `writeobjectxy` *object_id*
+## `$73`: <code>writeobjectxy <i>object_id</i></code>
-## `$74`: `loademote` *emote_id*
+## `$74`: <code>loademote <i>emote_id</i></code>
-## `$75`: `showemote` *emote_id*, *object_id*, *length*
+## `$75`: <code>showemote <i>emote_id</i>, <i>object_id</i>, <i>length</i></code>
-## `$76`: `spriteface` *object_id*, *facing*
+## `$76`: <code>spriteface <i>object_id</i>, <i>facing</i></code>
-## `$77`: `follownotexact` *object2*, *object1*
+## `$77`: <code>follownotexact <i>object2</i>, <i>object1</i></code>
-## `$78`: `earthquake` *param*
+## `$78`: <code>earthquake <i>param</i></code>
-## `$79`: `changemap` *bank*, *blockdata_pointer*
+## `$79`: <code>changemap <i>bank</i>, <i>blockdata_pointer</i></code>
-## `$7A`: `changeblock` *x*, *y*, *block*
+## `$7A`: <code>changeblock <i>x</i>, <i>y</i>, <i>block</i></code>
## `$7B`: `reloadmap`
## `$7C`: `reloadmappart`
-## `$7D`: `writecmdqueue` *queue_pointer*
+## `$7D`: <code>writecmdqueue <i>queue_pointer</i></code>
-## `$7E`: `delcmdqueue` *byte*
+## `$7E`: <code>delcmdqueue <i>byte</i></code>
-## `$7F`: `playmusic` *music_id*
+## `$7F`: <code>playmusic <i>music_id</i></code>
## `$80`: `encountermusic`
-## `$81`: `musicfadeout` *music_id*, *length*
+## `$81`: <code>musicfadeout <i>music_id</i>, <i>length</i></code>
## `$82`: `playmapmusic`
## `$83`: `dontrestartmapmusic`
-## `$84`: `cry` *mon_id*
+## `$84`: <code>cry <i>mon_id</i></code>
-## `$85`: `playsound` *sfx_id*
+## `$85`: <code>playsound <i>sfx_id</i></code>
## `$86`: `waitsfx`
@@ -281,68 +281,68 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s
## `$88`: `specialsound`
-## `$89`: `passtoengine` *data_pointer*
+## `$89`: <code>passtoengine <i>data_pointer</i></code>
-## `$8A`: `newloadmap` *which_method*
+## `$8A`: <code>newloadmap <i>which_method</i></code>
-## `$8B`: `pause` *length*
+## `$8B`: <code>pause <i>length</i></code>
-## `$8C`: `deactivatefacing` *length*
+## `$8C`: <code>deactivatefacing <i>length</i></code>
-## `$8D`: `priorityjump` *script*
+## `$8D`: <code>priorityjump <i>script</i></code>
## `$8E`: `warpcheck`
-## `$8F`: `ptpriorityjump` *script*
+## `$8F`: <code>ptpriorityjump <i>script</i></code>
## `$90`: `return`
## `$91`: `end`
-## `$92`: `reloadandreturn` *which_method*
+## `$92`: <code>reloadandreturn <i>which_method</i></code>
## `$93`: `end_all`
-## `$94`: `pokemart` *dialog_id*, *mart_id*
+## `$94`: <code>pokemart <i>dialog_id</i>, <i>mart_id</i></code>
-## `$95`: `elevator` *floor_list*
+## `$95`: <code>elevator <i>floor_list</i></code>
-## `$96`: `trade` *trade_id*
+## `$96`: <code>trade <i>trade_id</i></code>
-## `$97`: `askforphonenumber` *contact_id*
+## `$97`: <code>askforphonenumber <i>contact_id</i></code>
-## `$98`: `phonecall` *call_id*
+## `$98`: <code>phonecall <i>call_id</i></code>
## `$99`: `hangup`
-## `$9A`: `describedecoration` *byte*
+## `$9A`: <code>describedecoration <i>byte</i></code>
-## `$9B`: `fruittree` *tree_id*
+## `$9B`: <code>fruittree <i>tree_id</i></code>
-## `$9C`: `specialphonecall` *call_id*
+## `$9C`: <code>specialphonecall <i>call_id</i></code>
## `$9D`: `checkphonecall`
-## `$9E`: `verbosegiveitem` *item_id*[, *quantity*=1]
+## `$9E`: <code>verbosegiveitem <i>item_id</i>[, <i>quantity</i>=1]</code>
-## `$9F`: `verbosegiveitem2` *item_id*, *variable*
+## `$9F`: <code>verbosegiveitem2 <i>item_id</i>, <i>variable</i></code>
-## `$A0`: `swarm` *swarm_id*, *map*
+## `$A0`: <code>swarm <i>swarm_id</i>, <i>map</i></code>
## `$A1`: `halloffame`
## `$A2`: `credits`
-## `$A3`: `warpfacing` *facing*, *map*, *x*, *y*
+## `$A3`: <code>warpfacing <i>facing</i>, <i>map</i>, <i>x</i>, <i>y</i></code>
-## `$A4`: `battletowertext` *memory*
+## `$A4`: <code>battletowertext <i>memory</i></code>
-## `$A5`: `landmarktotext` *landmark_id*, *memory*
+## `$A5`: <code>landmarktotext <i>landmark_id</i>, <i>memory</i></code>
-## `$A6`: `trainerclassname` *trainer_group*, *memory*
+## `$A6`: <code>trainerclassname <i>trainer_group</i>, <i>memory</i></code>
-## `$A7`: `name` *type*, *id*, *memory*
+## `$A7`: <code>name <i>type</i>, <i>id</i>, <i>memory</i></code>
-## `$A8`: `wait` *duration*
+## `$A8`: <code>wait <i>duration</i></code>
## `$A9`: `check_save`
diff --git a/docs/images/hp_exp_bar_border.png b/docs/images/hp_exp_bar_border.png
index 9d16a042b..f0f5d31a6 100644
--- a/docs/images/hp_exp_bar_border.png
+++ b/docs/images/hp_exp_bar_border.png
Binary files differ
diff --git a/docs/images/hp_exp_bar_border_fix.png b/docs/images/hp_exp_bar_border_fix.png
index 02d36f8a0..26135576f 100644
--- a/docs/images/hp_exp_bar_border_fix.png
+++ b/docs/images/hp_exp_bar_border_fix.png
Binary files differ
diff --git a/docs/images/port.png b/docs/images/port.png
index 8a18aad7d..3e05e0da7 100644
--- a/docs/images/port.png
+++ b/docs/images/port.png
Binary files differ
diff --git a/docs/images/port_fix.png b/docs/images/port_fix.png
index 055a377a5..3156b065d 100644
--- a/docs/images/port_fix.png
+++ b/docs/images/port_fix.png
Binary files differ
diff --git a/docs/map_scripts.md b/docs/map_scripts.md
index c6b1c58ba..2302257e7 100644
--- a/docs/map_scripts.md
+++ b/docs/map_scripts.md
@@ -1,40 +1,55 @@
# Map Scripts
-## `const_value set 2`
+## <code>const_value set 2</code>
-- **`const` *`MAPNAME_OBJECTNAME`***
+<pre>
+ const <i>MAPNAME</i>_<i>OBJECTNAME</i>
+</pre>
-## `MapName_MapScriptHeader:`
+## <code>MapName_MapScripts:</code>
-## `.SceneScripts: db` *N*
+### <code>.SceneScripts: db <i>N</i></code>
-- **`scene_script` *script***
+<pre>
+ scene_script <i>script</i>
+</pre>
-## `.MapCallbacks: db` *N*
+### <code>.MapCallbacks: db <i>N</i></code>
-- **`dbw` *type*, *script***
+<pre>
+ callback <i>type</i>, <i>script</i>
+</pre>
Callback types:
-- **`MAPCALLBACK_NEWMAP`**
+- `MAPCALLBACK_NEWMAP`
-- **`MAPCALLBACK_TILES`**
+- `MAPCALLBACK_TILES`
-- **`MAPCALLBACK_OBJECTS`**
+- `MAPCALLBACK_OBJECTS`
-- **`MAPCALLBACK_SPRITES`**
+- `MAPCALLBACK_SPRITES`
-- **`MAPCALLBACK_CMDQUEUE`**
+- `MAPCALLBACK_CMDQUEUE`
- **`dbw CMDQUEUE_STONETABLE,` *table_pointer***
-
- **`stonetable` *warp_id*, *person*, *script***
-
- **`db -1 ; end`**
+<pre>
+ callback MAPCALLBACK_CMDQUEUE, .Boulders
+
+.Boulders:
+ writecmdqueue .BoulderCmdQueue
+ return
+
+.BoulderCmdQueue:
+ cmdqueue CMDQUEUE_STONETABLE, .BoulderTable
+
+.BoulderTable:
+ stonetable <i>warp_id</i>, <i>person</i>, <i>script</i>
+ db -1 ; end
+</pre>
## Event scripts
@@ -52,88 +67,106 @@ Callback types:
[Movement commands](movement_commands.md)
-## `MapName_MapEventHeader:`
+## <code>MapName_MapEvents:</code>
+```asm
; filler
db 0, 0
+```
-## `.Warps: db` *N*
+### <code>.Warps: db <i>N</i></code>
-- **`warp_def` *x*, *y*, *warp_id*, *map***
+<pre>
+ warp_def <i>x</i>, <i>y</i>, <i>warp_id</i>, <i>map</i>
+</pre>
-## `.CoordEvents: db` *N*
+### <code>.CoordEvents: db <i>N</i></code>
-- **`coord_event` *x*, *y*, *scene_id*, *script***
+<pre>
+ coord_event <i>x</i>, <i>y</i>, <i>scene_id</i>, <i>script</i>
+</pre>
-## `.BGEvents: db` *N*
+### <code>.BGEvents: db <i>N</i></code>
-- **`bg_event` *x*, *y*, *type*, *script***
+<pre>
+ bg_event <i>x</i>, <i>y</i>, <i>type</i>, <i>script</i>
+</pre>
BG event types:
-- **`BGEVENT_READ`**
+- `BGEVENT_READ`
-- **`BGEVENT_UP/DOWN/LEFT/RIGHT`**
+- `BGEVENT_UP/DOWN/LEFT/RIGHT`
-- **`BGEVENT_IFSET/IFNOTSET`**
+- `BGEVENT_IFSET/IFNOTSET`
- **`dw` *event_flag*, *script***
+<pre>
+ conditional_event <i>event_flag</i>, <i>script</i>
+</pre>
-- **`BGEVENT_ITEM`**
+- `BGEVENT_ITEM`
- **`dwb` *event_flag*, *item_id***
+<pre>
+ hiddenitem <i>event_flag</i>, <i>item_id</i>
+</pre>
-- **`BGEVENT_COPY`**
+- `BGEVENT_COPY`
-## `.ObjectEvents: db` *N*
+### <code>.ObjectEvents: db <i>N</i></code>
-- **`object_event` *x*, *y*, *sprite*, *movement*, *rx*, *ry*, *h1*, *h2*, *palette*, *type*, *range*, *script*, *event_flag***
+<pre>
+ object_event <i>x</i>, <i>y</i>, <i>sprite</i>, <i>movement</i>, <i>rx</i>, <i>ry</i>, <i>h1</i>, <i>h2</i>, <i>palette</i>, <i>type</i>, <i>range</i>, <i>script</i>, <i>event_flag</i>
+</pre>
Movement types:
-- **`SPRITEMOVEDATA_ITEM_TREE`**
+- `SPRITEMOVEDATA_ITEM_TREE`
-- **`SPRITEMOVEDATA_WANDER`**
+- `SPRITEMOVEDATA_WANDER`
-- **`SPRITEMOVEDATA_SPINRANDOM_SLOW`**
+- `SPRITEMOVEDATA_SPINRANDOM_SLOW`
-- **`SPRITEMOVEDATA_WALK_UP_DOWN`**
+- `SPRITEMOVEDATA_WALK_UP_DOWN`
-- **`SPRITEMOVEDATA_WALK_LEFT_RIGHT`**
+- `SPRITEMOVEDATA_WALK_LEFT_RIGHT`
-- **`SPRITEMOVEDATA_STANDING_UP/DOWN/LEFT/RIGHT`**
+- `SPRITEMOVEDATA_STANDING_UP/DOWN/LEFT/RIGHT`
-- **`SPRITEMOVEDATA_SPINRANDOM_FAST`**
+- `SPRITEMOVEDATA_SPINRANDOM_FAST`
-- **`SPRITEMOVEDATA_SNORLAX`**
+- `SPRITEMOVEDATA_SNORLAX`
-- **`SPRITEMOVEDATA_POKEMON`**
+- `SPRITEMOVEDATA_POKEMON`
-- **`SPRITEMOVEDATA_SUDOWOODO`**
+- `SPRITEMOVEDATA_SUDOWOODO`
-- **`SPRITEMOVEDATA_SMASHABLE_ROCK`**
+- `SPRITEMOVEDATA_SMASHABLE_ROCK`
-- **`SPRITEMOVEDATA_STRENGTH_BOULDER`**
+- `SPRITEMOVEDATA_STRENGTH_BOULDER`
-- **`SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE`**
+- `SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE`
-- **`SPRITEMOVEDATA_SPINCLOCKWISE`**
+- `SPRITEMOVEDATA_SPINCLOCKWISE`
-- **`SPRITEMOVEDATA_BIGDOLL`**
+- `SPRITEMOVEDATA_BIGDOLL`
-- **`SPRITEMOVEDATA_LAPRAS`**
+- `SPRITEMOVEDATA_LAPRAS`
Object types:
-- **`OBJECTTYPE_SCRIPT`**
+- `OBJECTTYPE_SCRIPT`
-- **`OBJECTTYPE_ITEMBALL`**
+- `OBJECTTYPE_ITEMBALL`
- **`itemball` *item_id***
+<pre>
+ itemball <i>item_id</i>
+</pre>
-- **`OBJECTTYPE_TRAINER`**
+- `OBJECTTYPE_TRAINER`
- **`trainer` *event_flag*, *group_id*, *trainer_id*, *seen_text*, *beaten_text*, *loss_text*, *script***
+<pre>
+ trainer <i>event_flag</i>, <i>group_id</i>, <i>trainer_id</i>, <i>seen_text</i>, <i>beaten_text</i>, <i>loss_text</i>, <i>script</i>
+</pre>
diff --git a/docs/menu.md b/docs/menu.md
new file mode 100644
index 000000000..71186a905
--- /dev/null
+++ b/docs/menu.md
@@ -0,0 +1,299 @@
+# Everything you've ever wanted to know about menus*
+
+**\* but were afraid to ask**
+
+
+## Contents
+
+- [ScrollingMenu](#scrollingmenu)
+- [\_2DMenu](#_2dmenu)
+- [DoNthMenu/SetUpMenu](#donthmenusetupmenu)
+- [VerticalMenu](#verticalmenu)
+- [Misc/Generic](#miscgeneric)
+
+
+## `ScrollingMenu`
+
+This is the only menu that does scrolling. It doesn't draw any `TextBox` around the menu.
+
+Structure:
+
+```asm
+.MenuDataHeader:
+ db MENU_BACKUP_TILES ; flags
+ menu_coords 2, 4, SCREEN_WIDTH - 1, 13
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2:
+ db 0 ; flags
+ db 5, 0 ; rows, columns
+ db 1 ; horizontal spacing
+ dba Items
+ dba Function1
+ dba Function2
+ dba Function3
+```
+
+`wMenuData2Flags`:
+
+```
+7: Select is functional
+6: Start is functional
+5: Call Function3
+4: Show arrows on the right-hand side
+3: D-Left is functional
+2: D-Right is functional
+1: Call Function3 only if [wSwitchItem] is 0
+0: Call Function1 to display the cancel entry
+```
+
+If the columns entry in `MenuDataHeader2` of a scrolling menu is 0, `Function2` isn't called either. It doesn't affect the position of the arrows.
+
+Call state for functions in `MenuDataHeader2` of `ScrollingMenu`:
+
+```
+All of them:
+[MenuSelection] = Current item. -1 is the CANCEL item.
+[MenuSelectionQuantity] = Quantity of the current item.
+
+Function1: Called to display a menu entry.
+de = Cursor position in TileMap
+
+Function2: Called to display the quantity of a menu entry.
+de = Cursor position in TileMap + columns
+
+Function3: Called to display anything else, whenever the cursor is moved.
+```
+
+There is no register of importance that should be preserved in any of these functions.
+
+The `; horizontal spacing` item in each `MenuData2` is a misnomer. It changes how the `Items` struct looks.
+
+If it's 1:
+
+```
+db entries not including cancel
+db entry1
+db entry2
+db -1 ; cancel
+...
+```
+
+If it's 2:
+
+```
+db entries not including cancel
+db entry1, quantity1
+db entry2, quantity2
+db -1 ; cancel
+...
+```
+
+In case it's 1, `[MenuSelectionQuantity]` will simply contain the next entry.
+
+## `_2DMenu`
+
+This, like is implied by the name, is a 2-dimensional menu, where you can move your cursor in all 4 directions. It's only used for the battle menus as well as Earl's academy.
+
+Structure:
+
+```asm
+.MenuDataHeader:
+ db MENU_BACKUP_TILES ; flags
+ db 12, 08 ; start coords
+ db 17, 19 ; end coords
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2:
+ db STATICMENU_CURSOR ; flags
+ dn 2, 2 ; rows, columns
+ db 6 ; spacing
+ dba Strings
+ dba Function
+```
+
+`wMenuData2Flags`:
+
+```
+7: Leave one tile of spacing between the left textbox border and the text, enabling the cursor.
+6: Don't leave one tile of spacing between the top textbox border and the text
+5: Set bits 4 and 5 in w2DMenuFlags1 (Wrap around horizontally and vertically)
+4: Unused
+3: Unused
+2: Unused
+1: Select is functional
+0: Disable B button
+```
+
+The bank for the `Strings` is generated when you call `_2DMenu`, and as such it doesn't really matter what bank you specify there (unless you callba `_2DMenu_` directly, of course).
+
+`; spacing` is not a misnomer here, it's used to define how much space there is between columns.
+
+`Function` is called after printing all the strings. `hl` will be pointed at the row below the last in the menu in `TileMap`. We don't know of its purpose, since it's never actually used anywhere. Only the bank number is always set to the same bank as the menu, but not used otherwise, since the address is 0.
+
+
+## `DoNthMenu`/`SetUpMenu`
+
+These are like the regular `VerticalMenu`, except they allow for creating slightly more "dynamic" menus, where the options aren't predefined, much like the `ScrollingMenu`.
+
+Structure:
+
+```
+.MenuDataHeader:
+ db MENU_BACKUP_TILES ; flags
+ menu_coords 0, 0, 10, 7
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2:
+ db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags
+ db 0 ; items
+ dw Items
+ dw DisplayFunction
+ dw StringPointers
+```
+
+`wMenuData2Flags`:
+
+```
+7: Unused
+6: Unused
+5: Set bit 5 in w2DMenuFlags1 (Wrap around vertically)
+4: Unused
+3: Start is functional
+2: D-left and D-right are functional
+1: Unused
+0: Unused
+```
+
+The `; items` entry should be left empty, as it's autogenerated with the `Items` array in `GetMenuIndexSet`.
+
+The bottom coord (`07` in the example) is autogenerated regardless of what you specify when building the MenuBox in `AutomaticGetMenuBottomCoord`, which also calculates the `bc` passed to MenuBox, which is useless because it's calculated again by MenuBox in `GetMenuBoxDims`.
+
+`[wWhichIndexSet]` decides which menu is used through `GetMenuIndexSet`. You can define multiple menus at the Items pointer as such:
+
+```
+Items:
+db entries not including cancel
+db entry1, entry2, entry3
+db -1 ; cancel
+db entries not including cancel for 2nd menu
+db entry1, entry2, entry3, entry4
+db -1 ; cancel
+```
+
+This is actively used in `MainMenu`.
+
+`StringPointers` isn't handled by `DoNthMenu` internally. It's handled by different `DisplayFunction`s. A custom one could choose to completely ignore it.
+
+`StringPointers` struct handled through `PlaceNthMenuStrings` as `DisplayFunction` and `MenuJumptable`:
+
+```asm
+StringPointers:
+ dw FunctionToCall, PointerToString ; index 1
+ dw FunctionToCall, PointerToString ; index 2
+...
+```
+
+`StringPointers` struct handled through `PlaceMenuStrings`:
+
+```asm
+StringPointers:
+ db "STRING1@"
+ db "STRING2@"
+...
+```
+
+Call state for `DisplayFunction`:
+```
+[MenuSelection] = Current item. -1 is the CANCEL item.
+de = Cursor position in TileMap
+```
+
+## `VerticalMenu`
+
+This is the simplest menu. Like, the most boring. Nothing special. Just normal. …nooooooormal…
+
+Structure:
+
+```asm
+.MenuDataHeader:
+ db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags
+ menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2:
+ db STATICMENU_CURSOR ; flags
+ db 2 ; # items
+ db "GIVE@"
+ db "TAKE@"
+```
+
+`wMenuData2Flags`:
+
+```
+7: Leave one tile of spacing between the left textbox border and the text
+6: Don't leave one tile of spacing between the top textbox border and the text
+5: Set bit 5 in w2DMenuFlags1 (Wrap around vertically)
+4: Place menubox "title". See notes.
+3: Unused
+2: Unused
+1: Select is functional
+0: Disable B button
+```
+
+If bit 4 is set, a string at the end of the items array will be put at an offset from the start coord of the menu box. This string is defined like this:
+
+```asm
+ db 2 ; # items
+ db "GIVE@"
+ db "TAKE@"
+ db 2 ; x offset
+ db "TEST@"
+```
+
+This is used in the menu for selecting the character's name.
+
+## Misc/Generic
+
+`MenuDataHeader` flags (`wMenuFlags`):
+
+```
+7: Save a backup of the tiles
+6: Save a backup of the tiles
+5: Unused
+4: Set bit 6 in w2DMenuFlags1 (Enable sprite animations)
+3: Disable click sound
+2: Unused
+1: Unused
+0: Call RestoreTileBackup when exiting the menu. This bit depends on whether bit 6 or 7 are set.
+```
+
+`w2DMenuFlags1`:
+
+```
+7: Disable checking of wMenuJoypadFilter
+6: Enable sprite animations
+5: Wrap around vertically
+4: Wrap around horizontally
+3: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far down
+2: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far up
+1: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far left
+0: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far right
+```
+
+`w2DMenuFlags2`:
+
+```
+7: ?????
+6: ?????
+5: ?????
+4: ?????
+3: ?????
+2: ?????
+1: ?????
+0: ?????
+```
diff --git a/docs/move_effect_commands.md b/docs/move_effect_commands.md
index b8b09c5c2..a7a779123 100644
--- a/docs/move_effect_commands.md
+++ b/docs/move_effect_commands.md
@@ -1,6 +1,6 @@
# Move Effect Commands
-Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands.asm) and [data/battle_command_pointers.asm:BattleCommandPointers](/data/battle_command_pointers.asm).
+Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands.asm) and [data/battle/effect_command_pointers.asm:BattleCommandPointers](/data/battle/effect_command_pointers.asm).
## `$01`: `checkturn`
diff --git a/docs/movement_commands.md b/docs/movement_commands.md
index 56b55f53e..10792c88b 100644
--- a/docs/movement_commands.md
+++ b/docs/movement_commands.md
@@ -3,33 +3,33 @@
Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/movement.asm:MovementPointers](/engine/movement.asm).
-## `$00`−`$03`: `turn_head` *direction*
+## `$00`−`$03`: <code>turn_head <i>direction</i></code>
-## `$04`−`$07`: `turn_step` *direction*
+## `$04`−`$07`: <code>turn_step <i>direction</i></code>
-## `$08`−`$0B`: `slow_step` *direction*
+## `$08`−`$0B`: <code>slow_step <i>direction</i></code>
-## `$0C`−`$0F`: `step` *direction*
+## `$0C`−`$0F`: <code>step <i>direction</i></code>
-## `$10`−`$13`: `big_step` *direction*
+## `$10`−`$13`: <code>big_step <i>direction</i></code>
-## `$14`−`$17`: `slow_slide_step` *direction*
+## `$14`−`$17`: <code>slow_slide_step <i>direction</i></code>
-## `$18`−`$1B`: `slide_step` *direction*
+## `$18`−`$1B`: <code>slide_step <i>direction</i></code>
-## `$1C`−`$1F`: `fast_slide_step` *direction*
+## `$1C`−`$1F`: <code>fast_slide_step <i>direction</i></code>
-## `$20`−`$23`: `turn_away` *direction*
+## `$20`−`$23`: <code>turn_away <i>direction</i></code>
-## `$24`−`$27`: `turn_in` *direction*
+## `$24`−`$27`: <code>turn_in <i>direction</i></code>
-## `$28`−`$2B`: `turn_waterfall` *direction*
+## `$28`−`$2B`: <code>turn_waterfall <i>direction</i></code>
-## `$2C`−`$2F`: `slow_jump_step` *direction*
+## `$2C`−`$2F`: <code>slow_jump_step <i>direction</i></code>
-## `$30`−`$33`: `jump_step` *direction*
+## `$30`−`$33`: <code>jump_step <i>direction</i></code>
-## `$34`−`$37`: `fast_jump_step` *direction*
+## `$34`−`$37`: <code>fast_jump_step <i>direction</i></code>
## `$38`: `remove_sliding`
@@ -43,11 +43,11 @@ Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engi
## `$3D`: `hide_object`
-## `$3E`−`$46`: `step_sleep` *length*
+## `$3E`−`$46`: <code>step_sleep <i>length</i></code>
## `$47`: `step_end`
-## `$48`: `step_48` *param*
+## `$48`: <code>step_48 <i>param</i></code>
## `$49`: `remove_object`
@@ -61,7 +61,7 @@ Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engi
## `$4E`: `skyfall`
-## `$4F`: `step_dig` *length*
+## `$4F`: <code>step_dig <i>length</i></code>
## `$50`: `step_bump`
@@ -73,12 +73,12 @@ Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engi
## `$54`: `show_emote`
-## `$55`: `step_shake` *displacement*
+## `$55`: <code>step_shake <i>displacement</i></code>
## `$56`: `tree_shake`
-## `$57`: `rock_smash` *length*
+## `$57`: <code>rock_smash <i>length</i></code>
-## `$58`: `return_dig` *length*
+## `$58`: <code>return_dig <i>length</i></code>
## `$59`: `skyfall_top`
diff --git a/docs/music_commands.md b/docs/music_commands.md
index 7f7bd8b32..3329f8df1 100644
--- a/docs/music_commands.md
+++ b/docs/music_commands.md
@@ -5,27 +5,32 @@ Defined in [macros/scripts/audio.asm](/macros/scripts/audio.asm) and [audio/engi
*See also: [Sound Engine Commands](https://github.com/pret/pokecrystal/wiki/Sound-Engine-Commands)*
-## `musicheader` *n*, *index*, *address*
+## <code>musicheader <i>n</i>, <i>index</i>, <i>address</i></code>
-## `note` *pitch*, *length*
+
+## <code>note <i>pitch</i>, <i>length</i></code>
(Used on all channels)
The high nibble is the note to play. 0 is rest, 1 is `C_`, 2 is `C#`, etc; `$C` is `B_`.
The low nibble is the length of the note. 1 gets added to this, so 0 still has a length.
-## `sound` *pitch*, *octave*, *intensity*, *frequency*
-## `noise` *pitch*, *duration*, *intensity*, *frequency*
+## <code>sound <i>pitch</i>, <i>octave</i>, <i>intensity</i>, <i>frequency</i></code>
+
+
+## <code>noise <i>pitch</i>, <i>duration</i>, <i>intensity</i>, <i>frequency</i></code>
-## `$D0`−`$D7`: `octave` *n*
+
+## `$D0`−`$D7`: <code>octave <i>n</i></code>
(Used in channels 1-3)
Sets the octave for the notes played on the channel.
`$D7` is the lowest octave, whereas `$D0` is the highest.
-## `$D8`: `notetype` *length*[, *intensity*]
+
+## `$D8`: <code>notetype <i>length</i>[, <i>intensity</i>]</code>
(Used in channels 1-4) (When using in channel 4, the *intensity* byte is not needed)
@@ -34,7 +39,8 @@ The first byte only reads the lower 4 bits, and multiplies it by the note length
The second byte is identical to the first byte in the `intensity` command.
-## `$D9`: `pitchoffset` *octave*, *key*
+
+## `$D9`: <code>pitchoffset <i>octave</i>, <i>key</i></code>
(Used in channels 1-3)
@@ -42,7 +48,8 @@ Transposes all notes played on the channel by a value.
The high nibble determins how many octaves to subtract, while the low nibble is how many note values to add.
Ex: Setting a value of `$13` would make a `C_`4 play as a `D#`3.
-## `$DA`: `tempo` *tempo*
+
+## `$DA`: <code>tempo <i>tempo</i></code>
(Used in channel 1)
@@ -53,7 +60,8 @@ This formula also works backwards to convert BPM to tempo: Tempo = 19200 / BPM
Only set or change this value when all playing channels are triggering a note or rest at the same time, otherwise desyncs may happen.
-## `$DB`: `dutycycle` *duty_cycle*
+
+## `$DB`: <code>dutycycle <i>duty_cycle</i></code>
(Used on channels 1&2)
@@ -64,7 +72,8 @@ Sets the square duty (sound) for the current channel. To change the sound for ch
- 2 = 50% waveform: `____¯¯¯¯`
- 3 = 75% waveform: `__¯¯¯¯¯¯` (sounds the same as 25%)
-## `$DC`: `intensity` *intensity*
+
+## `$DC`: <code>intensity <i>intensity</i></code>
(Used on channels 1-3) (Used to set instrument on channel 3)
@@ -74,9 +83,11 @@ This sets the volume and fade of the notes. The high nibble is the starting volu
For channel 3:
The high nibble sets the volume of channel 3. Only 4 values are accepted (0=Mute, 1=100% volume, 2=50% volume, 3=25% volume). The low nibble sets the instrument/waveform for channel 3 to play. Crystal natively has 10 instruments, values 0-9.
-## `$DD`: `soundinput` *input*
-## `$DE`: `sound_duty` *a*, *b*, *c*, *d*
+## `$DD`: <code>soundinput <i>input</i></code>
+
+
+## `$DE`: <code>sound_duty <i>a</i>, <i>b</i>, <i>c</i>, <i>d</i></code>
(Used on channels 1&2)
@@ -84,9 +95,11 @@ This cycles the channel through 4 duty definitions, one per frame.
Each pair of bits defines a duty, same as the `dutycycle` command.
This is mostly only used in cries, SFX, and Jigglypuff's song in RBY.
+
## `$DF`: `togglesfx`
-## `$E0`: `slidepitchto` *duration*, *octave*, *pitch*
+
+## `$E0`: <code>slidepitchto <i>duration</i>, <i>octave</i>, <i>pitch</i></code>
(Used on channel 1)
@@ -95,7 +108,8 @@ The first byte tells how many frames to play the destination note for, before th
The high nibble of the second byte is the octave of the destination note.
The low nibble of the second byte is the destination note. If rest is used as the destination note, then the whole destination pitch becomes `$0000` (the lowest pitch).
-## `$E1`: `vibrato` *delay*, *extent*
+
+## `$E1`: <code>vibrato <i>delay</i>, <i>extent</i></code>
(Used on channels 1-3)
@@ -105,20 +119,23 @@ Second byte, high nibble is the speed timer. It will decrement by one each frame
Second byte, low nibble is the pitch depth. Half of this value will alternate between adding to the pitch, and subtracting from the pitch each time speed timer resets. When this is an odd number, the value added to the pitch will be greater than the value subtracted from the pitch.
Ex: normal pitch of 405, if pitch depth = 3, it will alternate between 407 and 404. Speed timer does NOT reset when a new note is played. only when the song stops or changes. (Also, because a timer counts 0, a timer of 5 will take 6 frames to change.)
-## `$E2`: `unknownmusic0xe2` *unknown*
-## `$E3`: `togglenoise` *id*
+## `$E2`: <code>unknownmusic0xe2 <i>unknown</i></code>
+
+
+## `$E3`: <code>togglenoise <i>id</i></code>
(Used on channel 4)
Sets the "drum kit" to be used. This needs to be called before channel 4 can make any noise.
Calling it more than once in a song will mute the channel. (Keep it out of loops!)
-## `$E4`: `panning` *tracks*
-## `$E5`: `volume` *volume*
+## `$E4`: <code>panning <i>tracks</i></code>
-## `$E6`: `tone` *tone*
+## `$E5`: <code>volume <i>volume</i></code>
+
+## `$E6`: <code>tone <i>tone</i></code>
(Used on channel 1-3)
@@ -126,52 +143,77 @@ This modifies the pitch of the notes (fine tuning).
It makes notes sound better if multiple channels play the same note simultaneously.
A lot of GSC songs set the main melody channel with a value of 1, and the secondary channel (not bass) as 2.
-## `$E7`: `unknownmusic0xe7` *unknown*
-## `$E8`: `unknownmusic0xe8` *unknown*
+## `$E7`: <code>unknownmusic0xe7 <i>unknown</i></code>
+
+
+## `$E8`: <code>unknownmusic0xe8 <i>unknown</i></code>
+
+
+## `$E9`: <code>tempo_relative <i>value</i></code>
-## `$E9`: `tempo_relative` *value*
-## `$EA`: `restartchannel` *address*
+## `$EA`: <code>restartchannel <i>address</i></code>
-## `$EB`: `newsong` *id*
-## `$EC`: `sfxpriorityon`
+## `$EB`: <code>newsong <i>id</i></code>
-## `$ED`: `sfxpriorityoff`
-## `$EE`: `unknownmusic0xee` *address*
+## `$EC`: <code>sfxpriorityon</i></code>
-## `$EF`: `stereopanning` *tracks*
-## `$F0`: `sfxtogglenoise` *id*
+## `$ED`: <code>sfxpriorityoff</i></code>
+
+
+## `$EE`: <code>unknownmusic0xee <i>address</i></code>
+
+
+## `$EF`: <code>stereopanning <i>tracks</i></code>
+
+
+## `$F0`: <code>sfxtogglenoise <i>id</i></code>
+
## `$F1`: `music0xf1`
+
## `$F2`: `music0xf2`
+
## `$F3`: `music0xf3`
+
## `$F4`: `music0xf4`
+
## `$F5`: `music0xf5`
+
## `$F6`: `music0xf6`
+
## `$F7`: `music0xf7`
+
## `$F8`: `music0xf8`
+
## `$F9`: `unknownmusic0xf9`
-## `$FA`: `setcondition` *condition*
-## `$FB`: `jumpif` *condition*, *address*
+## `$FA`: <code>setcondition <i>condition</i></code>
+
+
+## `$FB`: <code>jumpif <i>condition</i>, <i>address</i></code>
+
+
+## `$FC`: <code>jumpchannel <i>address</i></code>
+
+
+## `$FD`: <code>loopchannel <i>count</i>, <i>address</i></code>
-## `$FC`: `jumpchannel` *address*
-## `$FD`: `loopchannel` *count*, *address*
+## `$FE`: <code>callchannel <i>address</i></code>
-## `$FE`: `callchannel` *address*
## `$FF`: `endchannel`
diff --git a/docs/pic_animations.md b/docs/pic_animations.md
index ba11a1dc1..1075eb25b 100644
--- a/docs/pic_animations.md
+++ b/docs/pic_animations.md
@@ -5,9 +5,9 @@ Defined in [macros/scripts/gfx_anims.asm](/macros/scripts/gfx_anims.asm).
Pic animations are assembled in 3 parts:
- Top-level animations:
- - `frame` *#*, *duration*: Frame 0 is the original pic (no change)
- - `setrepeat` *#*: Sets the number of times to repeat
- - `dorepeat` *#*: Repeats from command *#* (starting from 0)
+ - <code>frame <i>N</i>, <i>duration</i></code>: Frame #0 is the original pic (no change)
+ - <code>setrepeat <i>N</i></code>: Sets the number of times to repeat
+ - <code>dorepeat <i>I</i></code>: Repeats from command #<i>I</i> (starting from 0)
- `end`
- Bitmasks:
diff --git a/docs/text_commands.md b/docs/text_commands.md
index b198d405d..5c797d828 100644
--- a/docs/text_commands.md
+++ b/docs/text_commands.md
@@ -3,32 +3,32 @@
Defined in [macros/scripts/text.asm](/macros/scripts/text.asm) and [home/text.asm:TextCommands](/home/text.asm).
-## `$00`: `text` *text*
+## `$00`: <code>text <i>text</i></code>
Start writing text until `"@"`.
-## `$4E`: `next` *text*
+## `$4E`: <code>next <i>text</i></code>
Move a line down.
-## `$4F`: `line` *text*
+## `$4F`: <code>line <i>text</i></code>
Start writing at the bottom line.
-## `$50`: `page` *text*
+## `$50`: <code>page <i>text</i></code>
Start a new Pokédex page.
-## `$51`: `para` *text*
+## `$51`: <code>para <i>text</i></code>
Start a new paragraph.
-## `$55`: `cont` *text*
+## `$55`: <code>cont <i>text</i></code>
Scroll to the next line.
@@ -43,24 +43,24 @@ End a text box.
Prompt the player to end a text box (initiating some other event).
-## `$01`: `text_from_ram` *address*
+## `$01`: <code>text_from_ram <i>address</i></code>
Write text from a RAM address.
-## `$02`: `text_bcd` *address*, *flags*
+## `$02`: <code>text_bcd <i>address</i>, <i>flags</i></code>
Write [BCD][bcd] from an address, typically RAM.
[bcd]: https://en.wikipedia.org/wiki/Binary-coded_decimal
-## `$03`: `text_move` *address*
+## `$03`: <code>text_move <i>address</i></code>
Move to a new tile.
-## `$04`: `text_box` *address*, *height*, *width*
+## `$04`: <code>text_box <i>address</i>, <i>height</i>, <i>width</i></code>
Draw a box.
@@ -86,7 +86,7 @@ first character column of the text box.
Start interpreting assembly code.
-## `$09`: `deciram` *address*, *bytes*, *digits*
+## `$09`: <code>deciram <i>address</i>, <i>bytes</i>, <i>digits</i></code>
Read *bytes* bytes from *address* and print them as a *digits*-digit number.
@@ -101,9 +101,9 @@ Exit.
Play `SFX_DEX_FANFARE_50_79`.
-## `$0C`: `limited_interpret_data` *number*
+## `$0C`: <code>limited_interpret_data <i>n</i></code>
-Print *number* `"…"`s.
+Print *n* `"…"`s.
## `$0D`: `link_wait_button`
@@ -141,9 +141,9 @@ Play `SFX_FANFARE`.
Play `SFX_SLOT_MACHINE_START`.
-## `$14`: `text_buffer` *id*
+## `$14`: <code>text_buffer <i>id</i></code>
-Write text from one of the following addresses (listed in `StringBufferPointers`):
+Write text from one of the following addresses (listed in [data/text_buffers.asm](/data/text_buffers.asm)):
0. `StringBuffer3`
1. `StringBuffer4`
@@ -159,6 +159,11 @@ Write text from one of the following addresses (listed in `StringBufferPointers`
Print the weekday.
-## `$16`: `text_jump` *address*
+## `$16`: <code>text_jump <i>address</i></code>
Write text from a different bank.
+
+
+## `$00`: `text_start`
+
+Start writing regular text again after a special command.