summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FAQ.md9
-rw-r--r--README.md3
-rw-r--r--constants/phone_constants.asm2
-rw-r--r--docs/_config.yml1
-rw-r--r--docs/battle_anim_commands.md12
-rw-r--r--docs/bugs_and_glitches.md142
-rw-r--r--docs/design_flaws.md62
-rw-r--r--docs/event_commands.md4
-rw-r--r--docs/index.md28
-rw-r--r--docs/menus.md (renamed from docs/menu.md)4
-rw-r--r--docs/move_effect_commands.md2
-rw-r--r--docs/movement_commands.md2
-rw-r--r--docs/music_commands.md4
-rw-r--r--docs/pic_animations.md8
-rw-r--r--docs/text_commands.md4
-rw-r--r--engine/events/elevator.asm6
-rw-r--r--engine/events/misc_scripts.asm6
-rw-r--r--engine/events/misc_scripts_2.asm4
-rw-r--r--engine/events/mom_phone.asm12
-rw-r--r--engine/events/overworld.asm2
-rw-r--r--engine/events/poisonstep.asm24
-rw-r--r--engine/events/pokecenter_pc.asm8
-rw-r--r--engine/gfx/color.asm2
-rw-r--r--engine/items/items.asm4
-rw-r--r--engine/items/mart.asm28
-rw-r--r--engine/menus/intro_menu.asm2
-rw-r--r--engine/overworld/events.asm26
-rw-r--r--engine/overworld/player_movement.asm16
-rw-r--r--engine/overworld/player_object.asm2
-rw-r--r--engine/overworld/scripting.asm8
-rw-r--r--engine/phone/phone.asm43
-rw-r--r--home/map.asm8
-rw-r--r--home/trainers.asm16
-rw-r--r--mobile/mobile_12_2.asm2
-rw-r--r--mobile/mobile_5c.asm6
-rw-r--r--mobile/mobile_5f.asm2
-rw-r--r--wram.asm94
37 files changed, 334 insertions, 274 deletions
diff --git a/FAQ.md b/FAQ.md
index 4858023c0..298c2e3e8 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -7,6 +7,7 @@
- [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
- [`gcc`: command not found](#gcc-command-not-found)
- ["ERROR: `UNION` already defined"](#error-union-already-defined)
+ - ["Expression must be 8-bit"](#expression-must-be-8-bit)
- ["Segmentation fault" from `rgbgfx`](#segmentation-fault-from-rgbgfx)
- ["Section is too big" or "Unable to place section in bank"](#section-is-too-big-or-unable-to-place-section-in-bank)
- ["Invalid file or object file version"](#invalid-file-or-object-file-version)
@@ -34,6 +35,10 @@ You need to install `gcc`. If you're using Cygwin, re-run its setup, and at "Sel
Download [**rgbds 0.3.8**][rgbds]. Older versions will not work.
+### "Expression must be 8-bit"
+
+Download [**rgbds 0.3.8**][rgbds]. Older versions will not work.
+
### "Segmentation fault" from `rgbgfx`
If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-bit rgbds**][rgbds].
@@ -57,7 +62,7 @@ If you added or changed any code, you've made a mistake while writing some of it
## How do I edit maps?
-For `asm` scripts, read [docs/map_event_scripts.md](docs/map_event_scripts.md). For `blk` layouts, use [Polished Map][polished-map].
+For `asm` scripts, read [docs/map_event_scripts.md](https://pret.github.io/pokecrystal/map_event_scripts). For `blk` layouts, use [Polished Map][polished-map].
## How do I edit the colors of an image?
@@ -71,7 +76,7 @@ It really depends on what image you're trying to change the colors of, where the
## How do I write new features?
-There are a number of special-purpose scripting languages, as described in [docs](docs/). For more general features, you'll need to code directly in [assembly language][asm]. Some of the [tutorials][tutorials] for specific features may also be helpful.
+There are a number of special-purpose scripting languages, as described in [docs](https://pret.github.io/pokecrystal/). For more general features, you'll need to code directly in [assembly language][asm]. Some of the [tutorials][tutorials] for specific features may also be helpful.
## I need more help!
diff --git a/README.md b/README.md
index 122bc5830..172a716fa 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ To set up the repository, see [INSTALL.md](INSTALL.md).
## See also
- [**FAQ**](FAQ.md)
-- [**Documentation**](docs/)
+- [**Documentation**][docs]
- [**Wiki**][wiki] (includes [tutorials][tutorials])
- **Discord:** [pret][discord]
- **IRC:** [freenode#pret][irc]
@@ -36,6 +36,7 @@ Other disassembly projects:
[pokeruby]: https://github.com/pret/pokeruby
[pokefirered]: https://github.com/pret/pokefirered
[pokeemerald]: https://github.com/pret/pokeemerald
+[docs]: https://pret.github.io/pokecrystal/
[wiki]: https://github.com/pret/pokecrystal/wiki
[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials
[discord]: https://discord.gg/6EuWgX9
diff --git a/constants/phone_constants.asm b/constants/phone_constants.asm
index 058772f2d..2005bd3cb 100644
--- a/constants/phone_constants.asm
+++ b/constants/phone_constants.asm
@@ -65,7 +65,7 @@
const PHONE_CONTACT_SCRIPT2_BANK
const PHONE_CONTACT_SCRIPT2_ADDR_LO
const PHONE_CONTACT_SCRIPT2_ADDR_HI
-PHONE_TABLE_WIDTH EQU const_value
+PHONE_CONTACT_SIZE EQU const_value
; maximum number of pokegear contacts
CONTACT_LIST_SIZE EQU 10
diff --git a/docs/_config.yml b/docs/_config.yml
index fc24e7a62..e69de29bb 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -1 +0,0 @@
-theme: jekyll-theme-hacker \ No newline at end of file
diff --git a/docs/battle_anim_commands.md b/docs/battle_anim_commands.md
index 16b19bd35..0a44be96c 100644
--- a/docs/battle_anim_commands.md
+++ b/docs/battle_anim_commands.md
@@ -1,6 +1,6 @@
# Battle Animation Commands
-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).
+Defined in [macros/scripts/battle_anims.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/battle_anims.asm) and [engine/battle_anims/anim_commands.asm:BattleAnimCommands](https://github.com/pret/pokecrystal/blob/master/engine/battle_anims/anim_commands.asm).
## `$00`−`$CF`: <code>anim_wait <i>length</i></code>
@@ -14,7 +14,7 @@ Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) a
Spawns an *object* at coordinate (*x*, *y*).
-- *object*: `ANIM_OBJ` constants (see [constants/battle_anim_constants.asm](/constants/battle_anim_constants.asm))
+- *object*: `ANIM_OBJ` constants (see [constants/battle_anim_constants.asm](https://github.com/pret/pokecrystal/blob/master/constants/battle_anim_constants.asm))
- *x*: the x position in pixels
- *y*: the y position in pixels
- *x_tile*: an added x position in tiles (8 pixels)
@@ -45,7 +45,7 @@ The y position also depends on the y offset defined by the object.
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))
+- *gfx*: `ANIM_GFX` constants (see [constants/battle_anim_constants.asm](https://github.com/pret/pokecrystal/blob/master/constants/battle_anim_constants.asm))
Caveats:
- These will override any currently-loaded GFX.
@@ -74,7 +74,7 @@ Objects are state machines. `anim_setobj` changes the state of an object.
Increments a bg effect's state.
-- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm](/constants/battle_anim_constants.asm))
+- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm](https://github.com/pret/pokecrystal/blob/master/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`.
@@ -94,7 +94,7 @@ Caveats:
## `$DB`: `anim_checkpokeball`
-Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/pokeball_wobble.asm).
+Sets `BattleAnimVar` to the result of [GetPokeBallWobble](https://github.com/pret/pokecrystal/blob/master/engine/battle_anims/pokeball_wobble.asm).
## `$DC`: `anim_transform`
@@ -179,7 +179,7 @@ Jumps to another script and decrements `param` until it reaches 0. Similar to `a
## `$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))
+- *bg_effect*: `ANIM_BG` constants (see [constants/battle_anim_constants.asm](https://github.com/pret/pokecrystal/blob/master/constants/battle_anim_constants.asm))
## `$F1`: <code>anim_bgp <i>colors</i></code>
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 9d62d6461..8d6ce988d 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -79,7 +79,7 @@ Some fixes are mentioned as breaking compatibility with link battles. This can b
([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=450))
-**Fix:** Edit `SpeciesItemBoost` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm)
+**Fix:** Edit `SpeciesItemBoost` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm)
```diff
; Double the stat
@@ -106,7 +106,7 @@ Some fixes are mentioned as breaking compatibility with link battles. This can b
([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=450))
-**Fix:** Edit `DittoMetalPowder` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+**Fix:** Edit `DittoMetalPowder` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
ld a, c
@@ -144,7 +144,7 @@ Some fixes are mentioned as breaking compatibility with link battles. This can b
This bug existed for all battles in Gold and Silver, and was only fixed for single-player battles in Crystal to preserve link compatibility.
-**Fix:** Edit `TruncateHL_BC` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm)
+**Fix:** Edit `TruncateHL_BC` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm)
```diff
.finish
@@ -172,7 +172,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=mHkyO5T5wZU&t=206))
-**Fix:** Edit `BattleCommand_EffectChance` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+**Fix:** Edit `BattleCommand_EffectChance` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
- ; BUG: 1/256 chance to fail even for a 100% effect chance,
@@ -215,7 +215,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=zuCLMikWo4Y))
-**Fix:** Edit `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm):
+**Fix:** Edit `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/belly_drum.asm):
```diff
BattleCommand_BellyDrum:
@@ -249,14 +249,14 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
**Fix:**
-First, edit [hram.asm](/hram.asm):
+First, edit [hram.asm](https://github.com/pret/pokecrystal/blob/master/hram.asm):
```diff
hClockResetTrigger:: db ; ffeb
+hIsConfusionDamage:: db ; ffec
```
-Then edit four routines in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+Then edit four routines in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
HitSelfInConfusion:
@@ -307,8 +307,8 @@ Then edit four routines in [engine/battle/effect_commands.asm](/engine/battle/ef
ld hl, HurtItselfText
call StdBattleTextBox
- call HitSelfInConfusion
+ call HitSelfInConfusion
- call BattleCommand_DamageCalc
+ call ConfusionDamageCalc
call BattleCommand_LowerSub
@@ -339,7 +339,7 @@ Then edit four routines in [engine/battle/effect_commands.asm](/engine/battle/ef
This bug affects Acid, Iron Tail, and Rock Smash.
-**Fix:** Edit `DefenseDownHit` in [data/moves/effects.asm](/data/moves/effects.asm):
+**Fix:** Edit `DefenseDownHit` in [data/moves/effects.asm](https://github.com/pret/pokecrystal/blob/master/data/moves/effects.asm):
```diff
DefenseDownHit:
@@ -373,7 +373,7 @@ This bug affects Acid, Iron Tail, and Rock Smash.
([Video](https://www.youtube.com/watch?v=uRYyzKRatFk))
-**Fix:** Edit `BattleCommand_Counter` in [engine/battle/move_effects/counter.asm](/engine/battle/move_effects/counter.asm) and `BattleCommand_MirrorCoat` in [engine/battle/move_effects/mirror_coat.asm](/engine/battle/move_effects/mirror_coat.asm):
+**Fix:** Edit `BattleCommand_Counter` in [engine/battle/move_effects/counter.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/counter.asm) and `BattleCommand_MirrorCoat` in [engine/battle/move_effects/mirror_coat.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/mirror_coat.asm):
```diff
- ; BUG: Move should fail with all non-damaging battle actions
@@ -401,7 +401,7 @@ Add this to the end of each file:
([Video](https://www.youtube.com/watch?v=1v9x4SgMggs))
-**Fix:** Edit `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engine/battle/core.asm):
+**Fix:** Edit `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm):
```diff
.done
@@ -426,7 +426,7 @@ Add this to the end of each file:
([Video](https://www.youtube.com/watch?v=tiRvw-Nb2ME))
-**Fix:** Edit `PursuitSwitch` in [engine/battle/core.asm](/engine/battle/core.asm)
+**Fix:** Edit `PursuitSwitch` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm)
```diff
ld a, $f0
@@ -456,7 +456,7 @@ Add this to the end of each file:
This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider Web, Transform, and stat-lowering effects of moves like String Shot or Bubble during the semi-invulnerable turn of Fly or Dig.
-**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
CheckHiddenOpponent:
@@ -475,7 +475,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider
([Video](https://www.youtube.com/watch?v=202-iAsrIa8))
-**Fix:** Edit `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm):
+**Fix:** Edit `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/beat_up.asm):
```diff
.got_mon
@@ -511,7 +511,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider
This bug prevents the rest of Beat Up's effect from being executed if the player or enemy only has one Pokémon in their party while using it. It prevents Substitute from being raised and King's Rock from working.
-**Fix:** Edit `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+**Fix:** Edit `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
.only_one_beatup
@@ -540,7 +540,7 @@ This bug prevents the rest of Beat Up's effect from being executed if the player
This bug prevents Substitute from being raised if Beat Up was blocked by Protect or Detect.
-**Fix:** Edit `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm).
+**Fix:** Edit `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm).
```diff
cp EFFECT_MULTI_HIT
@@ -565,7 +565,7 @@ This bug prevents Substitute from being raised if Beat Up was blocked by Protect
This bug is caused because Beat Up never sets `wAttackMissed`, even when no Pokémon was able to attack (due to being fainted or having a status condition).
-**Fix:** Edit `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm):
+**Fix:** Edit `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/beat_up.asm):
```diff
BattleCommand_BeatUpFailText:
@@ -590,7 +590,7 @@ This bug is caused because Beat Up never sets `wAttackMissed`, even when no Pok
This bug existed for all battles in Gold and Silver, and was only fixed for single-player battles in Crystal to preserve link compatibility.
-**Fix:** Edit `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm):
+**Fix:** Edit `BattleCommand_Present` in [engine/battle/move_effects/present.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/present.asm):
```diff
BattleCommand_Present:
@@ -618,7 +618,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=cygMO-zHTls))
-**Fix:** Edit `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](/engine/battle/ai/scoring.asm):
+**Fix:** Edit `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/scoring.asm):
```diff
-; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy).
@@ -633,7 +633,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
## AI makes a false assumption about `CheckTypeMatchup`
-**Fix:** Edit `BattleCheckTypeMatchup` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+**Fix:** Edit `BattleCheckTypeMatchup` in [engine/battle/effect_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/effect_commands.asm):
```diff
BattleCheckTypeMatchup:
@@ -665,7 +665,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=rGqu3d3pdok&t=322))
-**Fix:** Edit `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battle/ai/items.asm):
+**Fix:** Edit `AI_HealStatus` in [engine/battle/ai/items.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/items.asm):
```diff
AI_HealStatus:
@@ -692,7 +692,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=SE-BfsFgZVM))
-**Fix:** Edit `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm):
+**Fix:** Edit `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/anim_hp_bar.asm):
```diff
- ; This routine is buggy. The result from ComputeHPBarPixels is stored
@@ -719,7 +719,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://www.youtube.com/watch?v=9KyNVIZxJvI))
-**Fix:** Edit `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm):
+**Fix:** Edit `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/anim_hp_bar.asm):
```diff
ld b, 0
@@ -747,7 +747,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points.
-**Fix:** Edit `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm):
+**Fix:** Edit `CalcExpAtLevel` in [engine/pokemon/experience.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokemon/experience.asm):
```diff
CalcExpAtLevel:
@@ -779,7 +779,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
([Video](https://www.youtube.com/watch?v=o54VjpAEoO8))
-**Fix:** Edit `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [data/text/common_2.asm](/data/text/common_2.asm):
+**Fix:** Edit `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [data/text/common_2.asm](https://github.com/pret/pokecrystal/blob/master/data/text/common_2.asm):
```diff
Text_ABoostedStringBuffer2ExpPoints::
@@ -803,7 +803,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
## BRN/PSN/PAR do not affect catch rate
-**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
-; This routine is buggy. It was intended that SLP and FRZ provide a higher
@@ -833,7 +833,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
## Moon Ball does not boost catch rate
-**Fix:** Edit `MoonBallMultiplier` in [items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `MoonBallMultiplier` in [items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
-; Moon Stone's constant from Pokémon Red is used.
@@ -851,7 +851,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
## Love Ball boosts catch rate for the wrong gender
-**Fix:** Edit `LoveBallMultiplier` in [items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `LoveBallMultiplier` in [items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
.wildmale
@@ -867,7 +867,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
## Fast Ball only boosts catch rate for three Pokémon
-**Fix:** Edit `FastBallMultiplier` in [items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `FastBallMultiplier` in [items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
.loop
@@ -889,7 +889,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
-**Fix:** Edit `ItemAttributes` in [data/items/attributes.asm](/data/items/attributes.asm):
+**Fix:** Edit `ItemAttributes` in [data/items/attributes.asm](https://github.com/pret/pokecrystal/blob/master/data/items/attributes.asm):
```diff
; DRAGON_FANG
@@ -906,7 +906,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
([Video](https://www.youtube.com/watch?v=8BvBjqxmyOk))
-**Fix:** Edit `DragonsDen1F_MapScripts` in [maps/DragonsDen1F.asm](/maps/DragonsDen1F.asm):
+**Fix:** Edit `DragonsDen1F_MapScripts` in [maps/DragonsDen1F.asm](https://github.com/pret/pokecrystal/blob/master/maps/DragonsDen1F.asm):
```diff
- db 0 ; callbacks
@@ -921,7 +921,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
## Daisy's grooming doesn't always increase happiness
-This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/events/haircut.asm):
+This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](https://github.com/pret/pokecrystal/blob/master/engine/events/haircut.asm):
```asm
; Bug: Subtracting $ff from $ff fails to set c.
@@ -958,7 +958,7 @@ CopyPokemonName_Buffer1_Buffer3:
jp CopyBytes
```
-**Fix:** Edit [data/events/happiness_probabilities.asm](/data/events/happiness_probabilities.asm):
+**Fix:** Edit [data/events/happiness_probabilities.asm](https://github.com/pret/pokecrystal/blob/master/data/events/happiness_probabilities.asm):
```diff
HappinessData_DaisysGrooming:
@@ -970,7 +970,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp in Lake of Rage are shorter, not longer
-**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm):
+**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm):
```diff
.CheckMagikarpArea:
@@ -1000,7 +1000,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp length limits have a unit conversion error
-**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](/engine/battle/core.asm):
+**Fix:** Edit `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/core.asm):
```diff
; Get Magikarp's length
@@ -1040,7 +1040,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp lengths can be miscalculated
-**Fix:** Edit `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](/engine/events/magikarp.asm):
+**Fix:** Edit `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](https://github.com/pret/pokecrystal/blob/master/engine/events/magikarp.asm):
```diff
.BCLessThanDE:
@@ -1068,7 +1068,7 @@ There are three things wrong here:
**Fix:**
-First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
+First, edit [engine/battle/battle_transition.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/battle_transition.asm):
```diff
StartTrainerBattle_DetermineWhichAnimation:
@@ -1130,14 +1130,14 @@ First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transiti
db BATTLETRANSITION_NO_CAVE_STRONGER
```
-Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
+Then edit [engine/battle/start_battle.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/start_battle.asm):
```diff
FindFirstAliveMonAndStartBattle:
xor a
ldh [hMapAnims], a
call DelayFrame
-- ld b, 6
+- ld b, PARTY_LENGTH
- ld hl, wPartyMon1HP
- ld de, PARTYMON_STRUCT_LENGTH - 1
-
@@ -1157,7 +1157,7 @@ Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
predef DoBattleTransition
```
-Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm):
+Finally, edit [engine/battle/read_trainer_party.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/read_trainer_party.asm):
```diff
INCLUDE "data/trainers/parties.asm"
@@ -1213,7 +1213,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
([Video](https://www.youtube.com/watch?v=iHkWubvxmSg))
-**Fix:** Edit `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/halloffame.asm](/engine/events/halloffame.asm):
+**Fix:** Edit `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/halloffame.asm](https://github.com/pret/pokecrystal/blob/master/engine/events/halloffame.asm):
```diff
ld a, [wHallOfFameTempWinCount]
@@ -1232,7 +1232,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I))
-**Fix:** Edit `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm):
+**Fix:** Edit `Slots_PayoutAnim` in [engine/games/slot_machine.asm](https://github.com/pret/pokecrystal/blob/master/engine/games/slot_machine.asm):
```diff
.okay
@@ -1251,7 +1251,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
## Team Rocket battle music is not used for Executives or Scientists
-**Fix:** Edit `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
+**Fix:** Edit `PlayBattleMusic` in [engine/battle/start_battle.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/start_battle.asm):
```diff
ld de, MUSIC_ROCKET_BATTLE
@@ -1270,13 +1270,13 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
## No bump noise if standing on tile `$3E`
-**Fix:** Edit `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm):
+**Fix:** Edit `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/player_movement.asm):
```diff
.CheckWarp:
-; Bug: Since no case is made for STANDING here, it will check
-; [.edgewarps + $ff]. This resolves to $3e at $8035a.
--; This causes wd041 to be nonzero when standing on tile $3e,
+-; This causes wWalkingIntoEdgeWarp to be nonzero when standing on tile $3e,
-; making bumps silent.
-
ld a, [wWalkingDirection]
@@ -1292,8 +1292,8 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
cp [hl]
jr nz, .not_warp
- ld a, 1
- ld [wd041], a
+ ld a, TRUE
+ ld [wWalkingIntoEdgeWarp], a
ld a, [wWalkingDirection]
- ; This is in the wrong place.
- cp STANDING
@@ -1307,7 +1307,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
The exact cause of this bug is unknown.
-**Workaround:** Edit `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm):
+**Workaround:** Edit `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokedex/pokedex.asm):
```diff
.Cry:
@@ -1325,31 +1325,31 @@ The exact cause of this bug is unknown.
## In-battle “`…`” ellipsis is too high
-This is a mistake with the “`…`” tile in [gfx/battle/hp_exp_bar_border.png](/gfx/battle/hp_exp_bar_border.png):
+This is a mistake with the “`…`” tile in [gfx/battle/hp_exp_bar_border.png](https://github.com/pret/pokecrystal/blob/master/gfx/battle/hp_exp_bar_border.png):
-![image](/gfx/battle/hp_exp_bar_border.png)
+![image](https://raw.githubusercontent.com/pret/pokecrystal/master/gfx/battle/hp_exp_bar_border.png)
**Fix:** Lower the ellipsis by two pixels:
-![image](/docs/images/hp_exp_bar_border.png)
+![image](https://raw.githubusercontent.com/pret/pokecrystal/master/docs/images/hp_exp_bar_border.png)
## Two tiles in the `port` tileset are drawn incorrectly
-This is a mistake with the left-hand warp carpet corner tiles in [gfx/tilesets/port.png](/gfx/tilesets/port.png):
+This is a mistake with the left-hand warp carpet corner tiles in [gfx/tilesets/port.png](https://github.com/pret/pokecrystal/blob/master/gfx/tilesets/port.png):
-![image](/gfx/tilesets/port.png)
+![image](https://raw.githubusercontent.com/pret/pokecrystal/master/gfx/tilesets/port.png)
**Fix:** Adjust them to match the right-hand corner tiles:
-![image](/docs/images/port.png)
+![image](https://raw.githubusercontent.com/pret/pokecrystal/master/docs/images/port.png)
## `LoadMetatiles` wraps around past 128 blocks
This bug prevents you from using blocksets with more than 128 blocks.
-**Fix:** Edit `LoadMetatiles` in [home/map.asm](/home/map.asm):
+**Fix:** Edit `LoadMetatiles` in [home/map.asm](https://github.com/pret/pokecrystal/blob/master/home/map.asm):
```diff
; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles).
@@ -1378,7 +1378,7 @@ This bug prevents you from using blocksets with more than 128 blocks.
**Fix:**
-First, edit `UsedSurfScript` in [engine/events/overworld.asm](/engine/events/overworld.asm):
+First, edit `UsedSurfScript` in [engine/events/overworld.asm](https://github.com/pret/pokecrystal/blob/master/engine/events/overworld.asm):
```diff
UsedSurfScript:
@@ -1399,7 +1399,7 @@ First, edit `UsedSurfScript` in [engine/events/overworld.asm](/engine/events/ove
end
```
-Then edit `SurfStartStep` in [engine/overworld/player_object.asm](/engine/overworld/player_object.asm):
+Then edit `SurfStartStep` in [engine/overworld/player_object.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/player_object.asm):
```diff
SurfStartStep:
@@ -1440,9 +1440,9 @@ Then edit `SurfStartStep` in [engine/overworld/player_object.asm](/engine/overwo
## Swimming NPCs aren't limited by their movement radius
-This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius.
+This bug is why the Lapras in [maps/UnionCaveB2F.asm](https://github.com/pret/pokecrystal/blob/master/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius.
-**Fix:** Edit `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm):
+**Fix:** Edit `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/npc_movement.asm):
```diff
ld hl, OBJECT_FLAGS1
@@ -1459,7 +1459,7 @@ This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), w
This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh with only traded legendary beasts.
-**Fix:** Edit `CheckOwnMon` in [engine/pokemon/search.asm](/engine/pokemon/search.asm):
+**Fix:** Edit `CheckOwnMon` in [engine/pokemon/search.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokemon/search.asm):
```diff
; check OT
@@ -1489,7 +1489,7 @@ This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh wit
This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch.
-**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
ld hl, wEnemySubStatus5
@@ -1534,7 +1534,7 @@ This bug can affect Mew or Pokémon other than Ditto that used Transform via Mir
([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU))
-**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
.room_in_party
@@ -1550,7 +1550,7 @@ This bug can affect Mew or Pokémon other than Ditto that used Transform via Mir
## `HELD_CATCH_CHANCE` has no effect
-**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
+**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```diff
- ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway.
@@ -1576,7 +1576,7 @@ This bug can affect Mew or Pokémon other than Ditto that used Transform via Mir
## Only the first three evolution entries can have Stone compatibility reported correctly
-**Workaround:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
+**Workaround:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokemon/party_menu.asm):
```diff
.DetermineCompatibility:
@@ -1600,7 +1600,7 @@ This supports up to six entries.
## `EVOLVE_STAT` can break Stone compatibility reporting
-**Fix:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
+**Fix:** Edit `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokemon/party_menu.asm):
```diff
.loop2
@@ -1620,7 +1620,7 @@ This supports up to six entries.
## `ScriptCall` can overflow `wScriptStack` and crash
-**Fix:** Edit `ScriptCall` in [engine/overworld/scripting.asm](/engine/overworld/scripting.asm):
+**Fix:** Edit `ScriptCall` in [engine/overworld/scripting.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/scripting.asm):
```diff
ScriptCall:
@@ -1663,7 +1663,7 @@ This supports up to six entries.
## `LoadSpriteGFX` does not limit the capacity of `UsedSprites`
-**Fix:** Edit `LoadSpriteGFX` in [engine/overworld/overworld.asm](/engine/overworld/overworld.asm):
+**Fix:** Edit `LoadSpriteGFX` in [engine/overworld/overworld.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/overworld.asm):
```diff
LoadSpriteGFX:
@@ -1699,7 +1699,7 @@ This supports up to six entries.
## `ChooseWildEncounter` doesn't really validate the wild Pokémon species
-**Fix:** Edit `ChooseWildEncounter` in [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm):
+**Fix:** Edit `ChooseWildEncounter` in [engine/overworld/wildmons.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/wildmons.asm):
```diff
.ok
@@ -1718,7 +1718,7 @@ This supports up to six entries.
## `TryObjectEvent` arbitrary code execution
-**Fix:** Edit `TryObjectEvent` in [engine/overworld/events.asm](/engine/overworld/events.asm):
+**Fix:** Edit `TryObjectEvent` in [engine/overworld/events.asm](https://github.com/pret/pokecrystal/blob/master/engine/overworld/events.asm):
```diff
-; Bug: If IsInArray returns nc, data at bc will be executed as code.
@@ -1745,7 +1745,7 @@ This supports up to six entries.
## `ClearWRAM` only clears WRAM bank 1
-**Fix:** Edit `ClearWRAM` in [home/init.asm](/home/init.asm):
+**Fix:** Edit `ClearWRAM` in [home/init.asm](https://github.com/pret/pokecrystal/blob/master/home/init.asm):
```diff
ClearWRAM::
@@ -1771,7 +1771,7 @@ This supports up to six entries.
## `BattleAnimCmd_ClearObjs` only clears the first 6⅔ objects
-**Fix:** Edit `BattleAnimCmd_ClearObjs` in [engine/battle_anims/anim_commands.asm](/engine/battle_anims/anim_commands.asm):
+**Fix:** Edit `BattleAnimCmd_ClearObjs` in [engine/battle_anims/anim_commands.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle_anims/anim_commands.asm):
```diff
BattleAnimCmd_ClearObjs:
diff --git a/docs/design_flaws.md b/docs/design_flaws.md
index 2227d2c3f..8669bc7a6 100644
--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -1,6 +1,6 @@
# Design Flaws
-These are parts of the code that do not work *incorrectly*, like [bugs and glitches](/docs/bugs_and_glitches.md), but that clearly exist just to work around a problem. In other words, with a slightly different design, the code would not need to exist at all. Design flaws may be exceptions to a usual rule, such as "tables of pointers in different banks use `dba`" ([one exception](#pic-banks-are-offset-by-pics_fix), [and another](#pokédex-entry-banks-are-derived-from-their-species-ids)) or "graphics used as a unit are stored and loaded contiguously" ([a notable exception](#footprints-are-split-into-top-and-bottom-halves)).
+These are parts of the code that do not work *incorrectly*, like [bugs and glitches](https://github.com/pret/pokecrystal/blob/master/docs/bugs_and_glitches.md), but that clearly exist just to work around a problem. In other words, with a slightly different design, the code would not need to exist at all. Design flaws may be exceptions to a usual rule, such as "tables of pointers in different banks use `dba`" ([one exception](#pic-banks-are-offset-by-pics_fix), [and another](#pokédex-entry-banks-are-derived-from-their-species-ids)) or "graphics used as a unit are stored and loaded contiguously" ([a notable exception](#footprints-are-split-into-top-and-bottom-halves)).
## Contents
@@ -17,7 +17,7 @@ These are parts of the code that do not work *incorrectly*, like [bugs and glitc
## Pic banks are offset by `PICS_FIX`
-[data/pokemon/pic_pointers.asm](/data/pokemon/pic_pointers.asm), [data/pokemon/unown_pic_pointers.asm](/data/pokemon/unown_pic_pointers.asm), and [data/trainers/pic_pointers.asm](/data/trainers/pic_pointers.asm) all have to use `dba_pic` instead of `dba`. This is a macro in [macros/data.asm](/macros/data.asm) that offsets banks by `PICS_FIX`:
+[data/pokemon/pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/pokemon/pic_pointers.asm), [data/pokemon/unown_pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/pokemon/unown_pic_pointers.asm), and [data/trainers/pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/trainers/pic_pointers.asm) all have to use `dba_pic` instead of `dba`. This is a macro in [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm) that offsets banks by `PICS_FIX`:
```asm
dba_pic: MACRO ; dbw bank, address
@@ -26,7 +26,7 @@ dba_pic: MACRO ; dbw bank, address
ENDM
```
-The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm):
+The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](https://github.com/pret/pokecrystal/blob/master/engine/gfx/load_pics.asm):
```asm
FixPicBank:
@@ -74,14 +74,14 @@ GLOBAL PICS_FIX
db BANK("Pics 24") ; BANK("Pics 1") + 23
```
-**Fix:** Delete `FixPicBank` and remove all four calls to `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm). Then use `dba` instead of `dba_pic` everywhere.
+**Fix:** Delete `FixPicBank` and remove all four calls to `FixPicBank` in [engine/gfx/load_pics.asm](https://github.com/pret/pokecrystal/blob/master/engine/gfx/load_pics.asm). Then use `dba` instead of `dba_pic` everywhere.
## `PokemonPicPointers` and `UnownPicPointers` are assumed to start at the same address
-`GetFrontpicPointer` and `GetMonBackpic` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm) make this assumption, which has to be accounted for in the data files.
+`GetFrontpicPointer` and `GetMonBackpic` in [engine/gfx/load_pics.asm](https://github.com/pret/pokecrystal/blob/master/engine/gfx/load_pics.asm) make this assumption, which has to be accounted for in the data files.
-In [gfx/pics.asm](/gfx/pics.asm):
+In [gfx/pics.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pics.asm):
```asm
; PokemonPicPointers and UnownPicPointers are assumed to start at the same
@@ -98,7 +98,7 @@ SECTION "Unown Pic Pointers", ROMX
INCLUDE "data/pokemon/unown_pic_pointers.asm"
```
-In [pokecrystal.link](/pokecrystal.link):
+In [pokecrystal.link](https://github.com/pret/pokecrystal/blob/master/pokecrystal.link):
```
ROMX $48
@@ -113,7 +113,7 @@ ROMX $49
**Fix:**
-Don't enforce `org $4000` in [pokecrystal.link](/pokecrystal.link).
+Don't enforce `org $4000` in [pokecrystal.link](https://github.com/pret/pokecrystal/blob/master/pokecrystal.link).
Edit `GetFrontpicPointer`:
@@ -160,7 +160,7 @@ And `GetMonBackpic`:
## Footprints are split into top and bottom halves
-In [gfx/footprints.asm](/gfx/footprints.asm):
+In [gfx/footprints.asm](https://github.com/pret/pokecrystal/blob/master/gfx/footprints.asm):
```asm
; Footprints are 2x2 tiles each, but are stored as a 16x64-tile image
@@ -195,7 +195,7 @@ INCBIN "gfx/footprints/wartortle.1bpp", footprint_bottom
...
```
-`Pokedex_LoadAnyFootprint` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm) has to load the halves separately.
+`Pokedex_LoadAnyFootprint` in [engine/pokedex/pokedex.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokedex/pokedex.asm) has to load the halves separately.
**Fix:**
@@ -240,13 +240,13 @@ Edit `Pokedex_LoadAnyFootprint`:
## Music IDs $64 and $80 or above have special behavior
-If a map's music ID in [data/maps/maps.asm](/master/data/maps/maps.asm) is $64 (the value of `MUSIC_MAHOGANY_MART` or `MUSIC_SUICUNE_BATTLE`) it will play either `MUSIC_ROCKET_HIDEOUT` or `MUSIC_CHERRYGROVE_CITY`. Moreover, if a map's music ID is $80 or above (the value of `RADIO_TOWER_MUSIC`) it might play `MUSIC_ROCKET_OVERTURE` or something else. This is caused by `GetMapMusic` in [home/map.asm](/master/home/map.asm).
+If a map's music ID in [data/maps/maps.asm](https://github.com/pret/pokecrystal/blob/master/master/data/maps/maps.asm) is $64 (the value of `MUSIC_MAHOGANY_MART` or `MUSIC_SUICUNE_BATTLE`) it will play either `MUSIC_ROCKET_HIDEOUT` or `MUSIC_CHERRYGROVE_CITY`. Moreover, if a map's music ID is $80 or above (the value of `RADIO_TOWER_MUSIC`) it might play `MUSIC_ROCKET_OVERTURE` or something else. This is caused by `GetMapMusic` in [home/map.asm](https://github.com/pret/pokecrystal/blob/master/master/home/map.asm).
**Fix:**
-Replace `RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY` with `MUSIC_RADIO_TOWER` in [data/maps/maps.asm](/master/data/maps/maps.asm).
+Replace `RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY` with `MUSIC_RADIO_TOWER` in [data/maps/maps.asm](https://github.com/pret/pokecrystal/blob/master/master/data/maps/maps.asm).
-Redefine the special music constants in [constants/music_constants.asm](/master/constants/music_constants.asm):
+Redefine the special music constants in [constants/music_constants.asm](https://github.com/pret/pokecrystal/blob/master/master/constants/music_constants.asm):
```diff
-; GetMapMusic picks music for this value (see home/map.asm)
@@ -318,7 +318,7 @@ Edit `GetMapMusic`:
## `ITEM_C3` and `ITEM_DC` break up the continuous sequence of TM items
-[constants/item_constants.asm](/constants/item_constants.asm) defined the 50 TMs in order with `add_tm`, but `ITEM_C3` and `ITEM_DC` break up that sequence.
+[constants/item_constants.asm](https://github.com/pret/pokecrystal/blob/master/constants/item_constants.asm) defined the 50 TMs in order with `add_tm`, but `ITEM_C3` and `ITEM_DC` break up that sequence.
```asm
add_tm DYNAMICPUNCH ; bf
@@ -335,7 +335,7 @@ Edit `GetMapMusic`:
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
```
-`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](/engine/items/items.asm) have to compensate for this.
+`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/items.asm) have to compensate for this.
> There was originally a good reason for these two gaps!
>
@@ -357,7 +357,7 @@ NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
> - Wild Dragonair's catch rate became 27 = $1B for `PROTEIN`
> - Wild Dragonite's catch rate became 9 = $09 for `ANTIDOTE`
>
-> Most catch rates were left as gaps in the item list, and transformed into held items via the `TimeCapsule_CatchRateItems` table in [data/items/catch_rate_items.asm](/data/items/catch_rate_items.asm). For example, the 52 Pokémon with catch rate 45 would hold the gap `ITEM_2D`, except that gets transformed into `BITTER_BERRY`.
+> Most catch rates were left as gaps in the item list, and transformed into held items via the `TimeCapsule_CatchRateItems` table in [data/items/catch_rate_items.asm](https://github.com/pret/pokecrystal/blob/master/data/items/catch_rate_items.asm). For example, the 52 Pokémon with catch rate 45 would hold the gap `ITEM_2D`, except that gets transformed into `BITTER_BERRY`.
>
> But a few Pokémon end up with weird items. Abra has a catch rate of 200, or $C8; and Krabby, Horsea, Goldeen, and Staryu have a catch rate of 225, or $E1. Those indexes correspond to the items `TM_PSYCH_UP` and `TM_ICE_PUNCH`, which seem like random choices—because they are.
>
@@ -369,7 +369,7 @@ NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data.
-Edit [engine/items/items.asm](/engine/items/items.asm):
+Edit [engine/items/items.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/items.asm):
```diff
GetTMHMNumber::
@@ -411,9 +411,9 @@ Edit [engine/items/items.asm](/engine/items/items.asm):
## Pokédex entry banks are derived from their species IDs
-`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.)
+`PokedexDataPointerTable` in [data/pokemon/dex_entry_pointers.asm](https://github.com/pret/pokecrystal/blob/master/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/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
+Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokedex/pokedex_2.asm):
```asm
GetDexEntryPointer:
@@ -449,7 +449,7 @@ GetDexEntryPointer:
db BANK("Pokedex Entries 193-251")
```
-`GetPokedexEntryBank` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
+`GetPokedexEntryBank` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
```asm
GetPokedexEntryBank:
@@ -475,7 +475,7 @@ GetPokedexEntryBank:
db BANK("Pokedex Entries 193-251")
```
-And `PokedexShow_GetDexEntryBank` in [engine/pokegear/radio.asm](/engine/pokegear/radio.asm):
+And `PokedexShow_GetDexEntryBank` in [engine/pokegear/radio.asm](https://github.com/pret/pokecrystal/blob/master/engine/pokegear/radio.asm):
```asm
PokedexShow_GetDexEntryBank:
@@ -502,12 +502,12 @@ PokedexShow_GetDexEntryBank:
db BANK("Pokedex Entries 193-251")
```
-**Fix:** Use `dba` instead of `dw` in `PokedexDataPointerTable`. Then edit [home.asm](/home.asm) to contain a single copy of the `PokedexDataPointerTable` lookup code, updated to work with 3-byte `dba` entries and get the bank from the first entry byte. Delete the three separate lookup routines and use the new one (placed in [home.asm](/home.asm) so it can be called from any bank.)
+**Fix:** Use `dba` instead of `dw` in `PokedexDataPointerTable`. Then edit [home.asm](https://github.com/pret/pokecrystal/blob/master/home.asm) to contain a single copy of the `PokedexDataPointerTable` lookup code, updated to work with 3-byte `dba` entries and get the bank from the first entry byte. Delete the three separate lookup routines and use the new one (placed in [home.asm](https://github.com/pret/pokecrystal/blob/master/home.asm) so it can be called from any bank.)
## Identical sine wave code and data is repeated five times
-`_Sine` in [engine/math/sine.asm](/engine/math/sine.asm):
+`_Sine` in [engine/math/sine.asm](https://github.com/pret/pokecrystal/blob/master/engine/math/sine.asm):
```asm
_Sine::
@@ -516,7 +516,7 @@ _Sine::
calc_sine_wave
```
-`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](/engine/gfx/sprites.asm):
+`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](https://github.com/pret/pokecrystal/blob/master/engine/gfx/sprites.asm):
```asm
Sprites_Cosine:
@@ -528,7 +528,7 @@ Sprites_Sine:
calc_sine_wave
```
-`BattleAnim_Cosine` and `BattleAnim_Sine` in [engine/battle_anims/functions.asm](/engine/battle_anims/functions.asm):
+`BattleAnim_Cosine` and `BattleAnim_Sine` in [engine/battle_anims/functions.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle_anims/functions.asm):
```asm
BattleAnim_Cosine:
@@ -545,14 +545,14 @@ BattleAnimSineWave:
sine_table 32
```
-`StartTrainerBattle_DrawSineWave` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
+`StartTrainerBattle_DrawSineWave` in [engine/battle/battle_transition.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/battle_transition.asm):
```asm
StartTrainerBattle_DrawSineWave:
calc_sine_wave
```
-And `CelebiEvent_Cosine` in [engine/events/celebi.asm](/engine/events/celebi.asm):
+And `CelebiEvent_Cosine` in [engine/events/celebi.asm](https://github.com/pret/pokecrystal/blob/master/engine/events/celebi.asm):
```asm
CelebiEvent_Cosine:
@@ -561,7 +561,7 @@ CelebiEvent_Cosine:
calc_sine_wave
```
-They all rely on `calc_sine_wave` in [macros/code.asm](/macros/code.asm):
+They all rely on `calc_sine_wave` in [macros/code.asm](https://github.com/pret/pokecrystal/blob/master/macros/code.asm):
```asm
calc_sine_wave: MACRO
@@ -612,7 +612,7 @@ endc
ENDM
```
-And on `sine_table` in [macros/data.asm](/macros/data.asm):
+And on `sine_table` in [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm):
```asm
sine_table: MACRO
@@ -625,12 +625,12 @@ endr
ENDM
```
-**Fix:** Edit [home/sine.asm](/home/sine.asm) to contain a single copy of the (co)sine code in bank 0, and call it from those five sites.
+**Fix:** Edit [home/sine.asm](https://github.com/pret/pokecrystal/blob/master/home/sine.asm) to contain a single copy of the (co)sine code in bank 0, and call it from those five sites.
## `GetForestTreeFrame` works, but it's still bad
-The routine `GetForestTreeFrame` in [engine/tilesets/tileset_anims.asm](/engine/tilesets/tileset_anims.asm) is hilariously inefficient.
+The routine `GetForestTreeFrame` in [engine/tilesets/tileset_anims.asm](https://github.com/pret/pokecrystal/blob/master/engine/tilesets/tileset_anims.asm) is hilariously inefficient.
**Fix:**
diff --git a/docs/event_commands.md b/docs/event_commands.md
index 4947d0971..0a114154f 100644
--- a/docs/event_commands.md
+++ b/docs/event_commands.md
@@ -1,6 +1,6 @@
# Event Commands
-Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](/engine/overworld/scripting.asm).
+Defined in [macros/scripts/events.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](https://github.com/pret/pokecrystal/blob/master/engine/overworld/scripting.asm).
Until this document is filled out, the [G/S Scripting Compendium](https://hax.iimarckus.org/files/scriptingcodes_eng.htm) has descriptions for most of these commands. It was written for G/S binary hacking and not Crystal assembly hacking, so it's not 100% accurate for pokecrystal.
@@ -489,7 +489,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` i
## `$93`: `endall`
-## `$94`: <code>pokemart <i>dialog_id</i>, <i>mart_id</i></code>
+## `$94`: <code>pokemart <i>mart_type</i>, <i>mart_id</i></code>
## `$95`: <code>elevator <i>floor_list</i></code>
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 000000000..5b0031672
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,28 @@
+These pages are for documenting pieces of the [pokecrystal](https://github.com/pret/pokecrystal) disassembly project. For more information, please see its [README.md](https://github.com/pret/pokecrystal/blob/master/README.md) and [wiki](https://github.com/pret/pokecrystal/wiki).
+
+
+## Issues with the source code
+
+- [bugs_and_glitches.md](bugs_and_glitches.md)
+- [design_flaws.md](design_flaws.md)
+
+
+## Map event scripts
+
+- [map_event_scripts.md](map_event_scripts.md)
+- [event_commands.md](event_commands.md)
+- [movement_commands.md](movement_commands.md)
+- [text_commands.md](text_commands.md)
+
+
+## Other types of scripts
+
+- [battle_anim_commands.md](battle_anim_commands.md)
+- [move_effect_commands.md](move_effect_commands.md)
+- [music_commands.md](music_commands.md)
+
+
+## Other subsystems
+
+- [pic_animations.md](pic_animations.md)
+- [menus.md](menus.md)
diff --git a/docs/menu.md b/docs/menus.md
index 67403bf15..b5a6e1e36 100644
--- a/docs/menu.md
+++ b/docs/menus.md
@@ -1,6 +1,4 @@
-# Everything you've ever wanted to know about menus*
-
-**\* but were afraid to ask**
+# Menu Data
## Contents
diff --git a/docs/move_effect_commands.md b/docs/move_effect_commands.md
index e8f239ef0..f2d365f94 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/effect_command_pointers.asm:BattleCommandPointers](/data/battle/effect_command_pointers.asm).
+Defined in [macros/scripts/battle_commands.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/battle_commands.asm) and [data/battle/effect_command_pointers.asm:BattleCommandPointers](https://github.com/pret/pokecrystal/blob/master/data/battle/effect_command_pointers.asm).
## `$01`: `checkturn`
diff --git a/docs/movement_commands.md b/docs/movement_commands.md
index 8dd278136..61ebf58de 100644
--- a/docs/movement_commands.md
+++ b/docs/movement_commands.md
@@ -1,6 +1,6 @@
# Movement Commands
-Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/overworld/movement.asm:MovementPointers](/engine/overworld/movement.asm).
+Defined in [macros/scripts/movement.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/movement.asm) and [engine/overworld/movement.asm:MovementPointers](https://github.com/pret/pokecrystal/blob/master/engine/overworld/movement.asm).
## `$00`−`$03`: <code>turn_head <i>direction</i></code>
diff --git a/docs/music_commands.md b/docs/music_commands.md
index 3329f8df1..676d426f7 100644
--- a/docs/music_commands.md
+++ b/docs/music_commands.md
@@ -1,8 +1,8 @@
# Music Commands
-Defined in [macros/scripts/audio.asm](/macros/scripts/audio.asm) and [audio/engine.asm:MusicCommands](/audio/engine.asm).
+Defined in [macros/scripts/audio.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/audio.asm) and [audio/engine.asm:MusicCommands](https://github.com/pret/pokecrystal/blob/master/audio/engine.asm).
-*See also: [Sound Engine Commands](https://github.com/pret/pokecrystal/wiki/Sound-Engine-Commands)*
+*See also: [Sound Engine Commands](https://github.com/pret/pokecrystal/blob/master/wiki/Sound-Engine-Commands)*
## <code>musicheader <i>n</i>, <i>index</i>, <i>address</i></code>
diff --git a/docs/pic_animations.md b/docs/pic_animations.md
index c1a0db934..70e24eac8 100644
--- a/docs/pic_animations.md
+++ b/docs/pic_animations.md
@@ -1,6 +1,6 @@
# Pic Animations
-Defined in [macros/scripts/gfx_anims.asm](/macros/scripts/gfx_anims.asm).
+Defined in [macros/scripts/gfx_anims.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/gfx_anims.asm).
Pic animations are assembled in 3 parts:
@@ -19,12 +19,12 @@ Pic animations are assembled in 3 parts:
Animation data is in these files:
-- [gfx/pokemon/anims.asm](/gfx/pokemon/anims.asm):
+- [gfx/pokemon/anims.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pokemon/anims.asm):
Main animations (played everywhere)
-- [gfx/pokemon/idles.asm](/gfx/pokemon/idles.asm):
+- [gfx/pokemon/idles.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pokemon/idles.asm):
Idle animations, appended to the main animation.
Used in the status screen (blinking, tail wags etc.)
-- [gfx/pokemon/unown_anims.asm](/gfx/pokemon/unown_anims.asm) and [gfx/pokemon/unown_idles.asm](/gfx/pokemon/unown_idles.asm):
+- [gfx/pokemon/unown_anims.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pokemon/unown_anims.asm) and [gfx/pokemon/unown_idles.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pokemon/unown_idles.asm):
Unown has its own animation data despite having an entry in the main tables.
diff --git a/docs/text_commands.md b/docs/text_commands.md
index 36a470cb8..13a905213 100644
--- a/docs/text_commands.md
+++ b/docs/text_commands.md
@@ -1,6 +1,6 @@
# Text Commands
-Defined in [macros/scripts/text.asm](/macros/scripts/text.asm) and [home/text.asm:TextCommands](/home/text.asm).
+Defined in [macros/scripts/text.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/text.asm) and [home/text.asm:TextCommands](https://github.com/pret/pokecrystal/blob/master/home/text.asm).
## `$00`: `text_start`
@@ -108,7 +108,7 @@ Play `SFX_SLOT_MACHINE_START`.
## `$14`: <code>text_buffer <i>id</i></code>
-Write text from one of the following addresses (listed in [data/text_buffers.asm](/data/text_buffers.asm)):
+Write text from one of the following addresses (listed in [data/text_buffers.asm](https://github.com/pret/pokecrystal/blob/master/data/text_buffers.asm)):
0. `StringBuffer3`
1. `StringBuffer4`
diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm
index 1f8c902ca..71b25bef7 100644
--- a/engine/events/elevator.asm
+++ b/engine/events/elevator.asm
@@ -28,7 +28,7 @@ Elevator::
.LoadFloors:
ld de, wCurElevator
- ld bc, 4
+ ld bc, wElevatorDataEnd - wElevatorData
ld hl, wElevatorPointer
ld a, [hli]
ld h, [hl]
@@ -104,12 +104,12 @@ Elevator_GoToFloor:
ld l, a
inc hl
pop af
- ld bc, 4
+ ld bc, wElevatorDataEnd - wElevatorData
call AddNTimes
inc hl
ld de, wBackupWarpNumber
ld a, [wElevatorPointerBank]
- ld bc, 3
+ ld bc, wElevatorDataEnd - wElevatorData - 1
call FarCopyBytes
ret
diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm
index e2ea5439a..653a9eb35 100644
--- a/engine/events/misc_scripts.asm
+++ b/engine/events/misc_scripts.asm
@@ -40,14 +40,14 @@ FindItemInBallScript::
.TryReceiveItem:
xor a
ld [wScriptVar], a
- ld a, [wEngineBuffer1]
+ ld a, [wItemBallItemID]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer3
call CopyName2
- ld a, [wEngineBuffer1]
+ ld a, [wItemBallItemID]
ld [wCurItem], a
- ld a, [wCurFruit]
+ ld a, [wItemBallQuantity]
ld [wItemQuantityChangeBuffer], a
ld hl, wNumItems
call ReceiveItem
diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm
index 4fececa48..36e4172a7 100644
--- a/engine/events/misc_scripts_2.asm
+++ b/engine/events/misc_scripts_2.asm
@@ -12,7 +12,7 @@ RepelWoreOffScript::
HiddenItemScript::
opentext
- readmem wEngineBuffer3
+ readmem wHiddenItemID
getitemname STRING_BUFFER_3, USE_SCRIPT_VAR
writetext .found_text
giveitem ITEM_FROM_MEM
@@ -42,7 +42,7 @@ HiddenItemScript::
text_end
SetMemEvent:
- ld hl, wEngineBuffer1
+ ld hl, wHiddenItemEvent
ld a, [hli]
ld d, [hl]
ld e, a
diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm
index 35269b3e5..052082395 100644
--- a/engine/events/mom_phone.asm
+++ b/engine/events/mom_phone.asm
@@ -39,13 +39,13 @@ MomTriesToBuySomething::
.ok
ld a, PHONE_MOM
ld [wCurCaller], a
- ld bc, wEngineBuffer2
- ld hl, 0
+ ld bc, wCallerContact
+ ld hl, PHONE_CONTACT_TRAINER_CLASS
add hl, bc
- ld [hl], 0
+ ld [hl], TRAINER_NONE
inc hl
- ld [hl], 1
- ld hl, wPhoneScriptPointer - wEngineBuffer2
+ ld [hl], PHONE_MOM
+ ld hl, PHONE_CONTACT_SCRIPT2_BANK
add hl, bc
ld a, BANK(Mom_GetScriptPointer)
ld [hli], a
@@ -147,7 +147,7 @@ Mom_GiveItemOrDoll:
ld [wCurItem], a
ld a, 1
ld [wItemQuantityChangeBuffer], a
- ld hl, wPCItems
+ ld hl, wNumPCItems
call ReceiveItem
ret
diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm
index 2e98dcc6c..788b0eb92 100644
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -500,7 +500,7 @@ TrySurfOW::
jr z, .quit
; Must be facing water.
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call GetTileCollision
cp WATERTILE
jr nz, .quit
diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm
index 6d4106a43..70da92f13 100644
--- a/engine/events/poisonstep.asm
+++ b/engine/events/poisonstep.asm
@@ -4,29 +4,29 @@ DoPoisonStep::
jr z, .no_faint
xor a
- ld c, 7
- ld hl, wEngineBuffer1
-.loop_clearEngineBuffer1
+ ld c, wPoisonStepDataEnd - wPoisonStepData
+ ld hl, wPoisonStepData
+.loop_clearPoisonStepData
ld [hli], a
dec c
- jr nz, .loop_clearEngineBuffer1
+ jr nz, .loop_clearPoisonStepData
xor a
ld [wCurPartyMon], a
.loop_check_poison
call .DamageMonIfPoisoned
jr nc, .not_poisoned
-; the output flag is stored in c, copy it to the ([wCurPartyMon] + 2)nd EngineBuffer
-; and set the corresponding flag in wEngineBuffer1
+; the output flag is stored in c, copy it to [wPoisonStepPartyFlags + [wCurPartyMon]]
+; and set the corresponding flag in wPoisonStepFlagSum
ld a, [wCurPartyMon]
ld e, a
ld d, 0
- ld hl, wEngineBuffer2
+ ld hl, wPoisonStepPartyFlags
add hl, de
ld [hl], c
- ld a, [wEngineBuffer1]
+ ld a, [wPoisonStepFlagSum]
or c
- ld [wEngineBuffer1], a
+ ld [wPoisonStepFlagSum], a
.not_poisoned
ld a, [wPartyCount]
@@ -35,10 +35,10 @@ DoPoisonStep::
cp [hl]
jr nz, .loop_check_poison
- ld a, [wEngineBuffer1]
+ ld a, [wPoisonStepFlagSum]
and %10
jr nz, .someone_has_fainted
- ld a, [wEngineBuffer1]
+ ld a, [wPoisonStepFlagSum]
and %01
jr z, .no_faint
call .PlayPoisonSFX
@@ -120,7 +120,7 @@ DoPoisonStep::
.CheckWhitedOut:
xor a
ld [wCurPartyMon], a
- ld de, wEngineBuffer2
+ ld de, wPoisonStepPartyFlags
.party_loop
push de
ld a, [de]
diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm
index 3dc02372d..767495592 100644
--- a/engine/events/pokecenter_pc.asm
+++ b/engine/events/pokecenter_pc.asm
@@ -354,7 +354,7 @@ PlayerWithdrawItemMenu:
ld [wItemQuantityChangeBuffer], a
ld a, [wBuffer2]
ld [wCurItemQuantity], a
- ld hl, wPCItems
+ ld hl, wNumPCItems
call TossItem
predef PartyMonItemName
ld hl, .WithdrewText
@@ -390,7 +390,7 @@ PlayerTossItemMenu:
.loop
call PCItemsJoypad
jr c, .quit
- ld de, wPCItems
+ ld de, wNumPCItems
farcall TossItemFromPC
jr .loop
@@ -509,7 +509,7 @@ PlayerDepositItemMenu:
ld [wBuffer1], a
ld a, [wCurItemQuantity]
ld [wBuffer2], a
- ld hl, wPCItems
+ ld hl, wNumPCItems
call ReceiveItem
jr nc, .NoRoomInPC
ld a, [wBuffer1]
@@ -628,7 +628,7 @@ PCItemsJoypad:
db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 8 ; rows/cols?
db 2 ; horizontal spacing?
- dbw 0, wPCItems
+ dbw 0, wNumPCItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index 57ea26102..ec500e85f 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -1091,7 +1091,7 @@ SGBBorder_MorePalPushing:
jr nz, .loop
ld bc, $140
call CopyData
- ld bc, Start
+ ld bc, $100
call ClearBytes
ld bc, 16 palettes
call CopyData
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 28c79f4cc..ef0f10dda 100644
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -145,10 +145,10 @@ GetPocketCapacity:
.not_bag
ld c, MAX_PC_ITEMS
ld a, e
- cp LOW(wPCItems)
+ cp LOW(wNumPCItems)
jr nz, .not_pc
ld a, d
- cp HIGH(wPCItems)
+ cp HIGH(wNumPCItems)
ret z
.not_pc
diff --git a/engine/items/mart.asm b/engine/items/mart.asm
index 59fe89dc9..ef06c4d11 100644
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -9,9 +9,9 @@
OpenMartDialog::
call GetMart
ld a, c
- ld [wEngineBuffer1], a
+ ld [wMartType], a
call LoadMartPointer
- ld a, [wEngineBuffer1]
+ ld a, [wMartType]
ld hl, .dialogs
rst JumpTable
ret
@@ -24,10 +24,10 @@ OpenMartDialog::
dw RooftopSale
MartDialog:
- ld a, 0
- ld [wEngineBuffer1], a
+ ld a, MARTTYPE_STANDARD
+ ld [wMartType], a
xor a ; STANDARDMART_HOWMAYIHELPYOU
- ld [wEngineBuffer5], a
+ ld [wMartJumptableIndex], a
call StandardMart
ret
@@ -105,8 +105,8 @@ LoadMartPointer:
xor a
ld bc, wCurMartEnd - wCurMart
call ByteFill
- xor a
- ld [wEngineBuffer5], a
+ xor a ; STANDARDMART_HOWMAYIHELPYOU
+ ld [wMartJumptableIndex], a
ld [wBargainShopFlags], a
ld [wFacingDirection], a
ret
@@ -138,13 +138,15 @@ GetMart:
const STANDARDMART_QUIT ; 4
const STANDARDMART_ANYTHINGELSE ; 5
+STANDARDMART_EXIT EQU -1
+
StandardMart:
.loop
- ld a, [wEngineBuffer5]
+ ld a, [wMartJumptableIndex]
ld hl, .MartFunctions
rst JumpTable
- ld [wEngineBuffer5], a
- cp -1
+ ld [wMartJumptableIndex], a
+ cp STANDARDMART_EXIT
jr nz, .loop
ret
@@ -202,7 +204,7 @@ StandardMart:
call ExitMenu
ld hl, Text_Mart_ComeAgain
call MartTextBox
- ld a, -1
+ ld a, STANDARDMART_EXIT
ret
.AnythingElse:
@@ -346,7 +348,7 @@ BuyMenu:
LoadBuyMenuText:
; load text from a nested table
-; which table is in wEngineBuffer1
+; which table is in wMartType
; which entry is in register a
push af
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
@@ -376,7 +378,7 @@ MartAskPurchaseQuantity:
jp RooftopSaleAskPurchaseQuantity
GetMartDialogGroup:
- ld a, [wEngineBuffer1]
+ ld a, [wMartType]
ld e, a
ld d, 0
ld hl, .MartTextFunctionPointers
diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm
index f6be52c52..c7c3058d1 100644
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -151,7 +151,7 @@ _ResetWRAM:
ld hl, wNumBalls
call .InitList
- ld hl, wPCItems
+ ld hl, wNumPCItems
call .InitList
xor a
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index a84d72db4..b3efa9d86 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -602,8 +602,8 @@ TryObjectEvent:
ld h, [hl]
ld l, a
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 2
+ ld de, wItemBallData
+ ld bc, wItemBallDataEnd - wItemBallData
call FarCopyBytes
ld a, PLAYEREVENT_ITEMBALL
scf
@@ -638,7 +638,7 @@ TryBGEvent:
ret
.is_bg_event:
- ld a, [wEngineBuffer3]
+ ld a, [wCurBGEventType]
ld hl, .bg_events
rst JumpTable
ret
@@ -675,7 +675,7 @@ TryBGEvent:
.read
call PlayTalkObject
- ld hl, wEngineBuffer4
+ ld hl, wCurBGEventScriptAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -689,8 +689,8 @@ TryBGEvent:
jp nz, .dontread
call PlayTalkObject
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 3
+ ld de, wHiddenItemData
+ ld bc, wHiddenItemDataEnd - wHiddenItemData
call FarCopyBytes
ld a, BANK(HiddenItemScript)
ld hl, HiddenItemScript
@@ -702,8 +702,8 @@ TryBGEvent:
call CheckBGEventFlag
jr nz, .dontread
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 3
+ ld de, wHiddenItemData
+ ld bc, wHiddenItemDataEnd - wHiddenItemData
call FarCopyBytes
jr .dontread
@@ -734,7 +734,7 @@ TryBGEvent:
ret
CheckBGEventFlag:
- ld hl, wEngineBuffer4
+ ld hl, wCurBGEventScriptAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1076,7 +1076,7 @@ LoadScriptBDE::
TryTileCollisionEvent::
call GetFacingTileCoord
- ld [wEngineBuffer1], a
+ ld [wFacingTileID], a
ld c, a
farcall CheckFacingTileForStdScript
jr c, .done
@@ -1087,21 +1087,21 @@ TryTileCollisionEvent::
jr .done
.whirlpool
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckWhirlpoolTile
jr nz, .waterfall
farcall TryWhirlpoolOW
jr .done
.waterfall
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckWaterfallTile
jr nz, .headbutt
farcall TryWaterfallOW
jr .done
.headbutt
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckHeadbuttTreeTile
jr nz, .surf
farcall TryHeadbuttOW
diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm
index e8f45d913..09d6b47de 100644
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -4,7 +4,7 @@ DoPlayerMovement::
ld a, movement_step_sleep
ld [wMovementAnimation], a
xor a
- ld [wd041], a
+ ld [wWalkingIntoEdgeWarp], a
call .TranslateIntoMovement
ld c, a
ld a, [wMovementAnimation]
@@ -98,7 +98,7 @@ DoPlayerMovement::
jr z, .Standing
; Walking into an edge warp won't bump.
- ld a, [wEngineBuffer4]
+ ld a, [wWalkingIntoEdgeWarp]
and a
jr nz, .CantMove
call .BumpSound
@@ -321,17 +321,17 @@ DoPlayerMovement::
.TrySurf:
call .CheckSurfPerms
- ld [wd040], a
+ ld [wWalkingIntoLand], a
jr c, .surf_bump
call .CheckNPC
- ld [wd03f], a
+ ld [wWalkingIntoNPC], a
and a
jr z, .surf_bump
cp 2
jr z, .surf_bump
- ld a, [wd040]
+ ld a, [wWalkingIntoLand]
and a
jr nz, .ExitWater
@@ -395,7 +395,7 @@ DoPlayerMovement::
.CheckWarp:
; Bug: Since no case is made for STANDING here, it will check
; [.edgewarps + $ff]. This resolves to $3e at $8035a.
-; This causes wd041 to be nonzero when standing on tile $3e,
+; This causes wWalkingIntoEdgeWarp to be nonzero when standing on tile $3e,
; making bumps silent.
ld a, [wWalkingDirection]
@@ -409,8 +409,8 @@ DoPlayerMovement::
cp [hl]
jr nz, .not_warp
- ld a, 1
- ld [wd041], a
+ ld a, TRUE
+ ld [wWalkingIntoEdgeWarp], a
ld a, [wWalkingDirection]
; This is in the wrong place.
cp STANDING
diff --git a/engine/overworld/player_object.asm b/engine/overworld/player_object.asm
index 4cdbaa313..9f1b13dd9 100644
--- a/engine/overworld/player_object.asm
+++ b/engine/overworld/player_object.asm
@@ -518,7 +518,7 @@ TrainerWalkToPlayer:
call InitMovementBuffer
ld a, movement_step_sleep
call AppendToMovementBuffer
- ld a, [wd03f]
+ ld a, [wWalkingIntoNPC]
dec a
jr z, .TerminateStep
ldh a, [hLastTalked]
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index a836bfe94..c622dc9db 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -637,7 +637,7 @@ PocketIsFullText:
Script_pokemart:
; script command 0x94
-; parameters: dialog_id, mart_id
+; parameters: mart_type, mart_id
call GetScriptByte
ld c, a
@@ -765,7 +765,7 @@ Script_trainertext:
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
ld b, a
call MapTextbox
ret
@@ -777,7 +777,7 @@ Script_scripttalkafter:
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
ld b, a
jp ScriptJump
@@ -787,7 +787,7 @@ Script_trainerflagaction:
xor a
ld [wScriptVar], a
- ld hl, wd041
+ ld hl, wTempTrainerEventFlag
ld e, [hl]
inc hl
ld d, [hl]
diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm
index c4c47d171..9582b5921 100644
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -163,12 +163,13 @@ CheckPhoneContactTimeOfDay:
ChooseRandomCaller:
; If no one is available to call, don't return anything.
- ld a, [wEngineBuffer3]
+ ld a, [wNumAvailableCallers]
and a
jr z, .NothingToSample
-; Sample a random number between 0 and 31.
+; Store the number of available callers in c.
ld c, a
+; Sample a random number between 0 and 31.
call Random
ldh a, [hRandomAdd]
swap a
@@ -178,7 +179,7 @@ ChooseRandomCaller:
; Return the caller ID you just sampled.
ld c, a
ld b, 0
- ld hl, wEngineBuffer4
+ ld hl, wAvailableCallers
add hl, bc
ld a, [hl]
scf
@@ -191,23 +192,23 @@ ChooseRandomCaller:
GetAvailableCallers:
farcall CheckTime
ld a, c
- ld [wEngineBuffer1], a
- ld hl, wEngineBuffer3
- ld bc, 11
+ ld [wCheckedTime], a
+ ld hl, wNumAvailableCallers
+ ld bc, CONTACT_LIST_SIZE + 1
xor a
call ByteFill
ld de, wPhoneList
ld a, CONTACT_LIST_SIZE
.loop
- ld [wEngineBuffer2], a
+ ld [wPhoneListIndex], a
ld a, [de]
and a
jr z, .not_good_for_call
ld hl, PhoneContacts + PHONE_CONTACT_SCRIPT2_TIME
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
- ld a, [wEngineBuffer1]
+ ld a, [wCheckedTime]
and [hl]
jr z, .not_good_for_call
ld bc, PHONE_CONTACT_MAP_GROUP - PHONE_CONTACT_SCRIPT2_TIME
@@ -220,18 +221,18 @@ GetAvailableCallers:
cp [hl]
jr z, .not_good_for_call
.different_map
- ld a, [wEngineBuffer3]
+ ld a, [wNumAvailableCallers]
ld c, a
ld b, $0
inc a
- ld [wEngineBuffer3], a
- ld hl, wEngineBuffer4
+ ld [wNumAvailableCallers], a
+ ld hl, wAvailableCallers
add hl, bc
ld a, [de]
ld [hl], a
.not_good_for_call
inc de
- ld a, [wEngineBuffer2]
+ ld a, [wPhoneListIndex]
dec a
jr nz, .loop
ret
@@ -261,7 +262,7 @@ CheckSpecialPhoneCall::
push hl
call LoadCallerScript
pop hl
- ld de, wPhoneScriptPointer
+ ld de, wCallerContact + PHONE_CONTACT_SCRIPT2_BANK
ld a, [hli]
ld [de], a
inc de
@@ -323,7 +324,7 @@ Function90199:
ld a, b
ld [wCurCaller], a
ld hl, PhoneContacts
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld d, h
ld e, l
@@ -398,13 +399,13 @@ LoadCallerScript:
.actualcaller
ld hl, PhoneContacts
- ld bc, 12
+ ld bc, PHONE_CONTACT_SIZE
ld a, e
call AddNTimes
ld a, BANK(PhoneContacts)
.proceed
- ld de, wEngineBuffer2
- ld bc, 12
+ ld de, wCallerContact
+ ld bc, PHONE_CONTACT_SIZE
call FarCopyBytes
ret
@@ -422,7 +423,7 @@ WrongNumber:
Script_ReceivePhoneCall:
refreshscreen
callasm RingTwice_StartCall
- memcall wPhoneScriptPointer
+ memcall wCallerContact + PHONE_CONTACT_SCRIPT2_BANK
waitbutton
callasm HangUp
closetext
@@ -620,7 +621,7 @@ CheckCanDeletePhoneNumber:
GetCallerTrainerClass:
push hl
ld hl, PhoneContacts + PHONE_CONTACT_TRAINER_CLASS
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld a, [hli]
ld b, [hl]
@@ -687,7 +688,7 @@ GetCallerLocation:
push de
ld a, [wCurCaller]
ld hl, PhoneContacts + PHONE_CONTACT_MAP_GROUP
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld b, [hl]
inc hl
diff --git a/home/map.asm b/home/map.asm
index 6600cd7db..391500eb2 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -1782,7 +1782,7 @@ CheckFacingBGEvent::
ret
CheckIfFacingTileCoordIsBGEvent::
-; Checks to see if you are facing a BG event. If so, copies it into wEngineBuffer1 and sets carry.
+; Checks to see if you are facing a BG event. If so, copies it into wCurBGEvent and sets carry.
ld hl, wCurMapBGEventsPointer
ld a, [hli]
ld h, [hl]
@@ -1813,7 +1813,7 @@ CheckIfFacingTileCoordIsBGEvent::
.copysign
pop hl
- ld de, wCurBGEventYCoord
+ ld de, wCurBGEvent
ld bc, BG_EVENT_SIZE
call CopyBytes
scf
@@ -1836,7 +1836,7 @@ CheckCurrentMapCoordEvents::
ret
.CoordEventCheck:
-; Checks to see if you are standing on a coord event. If yes, copies the event to wEngineBuffer1 and sets carry.
+; Checks to see if you are standing on a coord event. If yes, copies the event to wCurCoordEvent and sets carry.
ld hl, wCurMapCoordEventsPointer
ld a, [hli]
ld h, [hl]
@@ -1885,7 +1885,7 @@ CheckCurrentMapCoordEvents::
.copy_coord_event
pop hl
- ld de, wCurCoordEventSceneID
+ ld de, wCurCoordEvent
ld bc, COORD_EVENT_SIZE
call CopyBytes
scf
diff --git a/home/trainers.asm b/home/trainers.asm
index 8d13cf5b1..9d012f719 100644
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -95,31 +95,31 @@ _CheckTrainerBattle::
pop af
ldh [hLastTalked], a
ld a, b
- ld [wEngineBuffer2], a
+ ld [wSeenTrainerDistance], a
ld a, c
- ld [wEngineBuffer3], a
+ ld [wSeenTrainerDirection], a
jr LoadTrainer_continue
TalkToTrainer::
ld a, 1
- ld [wEngineBuffer2], a
+ ld [wSeenTrainerDistance], a
ld a, -1
- ld [wEngineBuffer3], a
+ ld [wSeenTrainerDirection], a
LoadTrainer_continue::
call GetMapScriptsBank
- ld [wEngineBuffer1], a
+ ld [wSeenTrainerBank], a
ldh a, [hLastTalked]
call GetMapObject
ld hl, MAPOBJECT_SCRIPT_POINTER
add hl, bc
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
call GetFarHalfword
ld de, wTempTrainer
ld bc, wTempTrainerEnd - wTempTrainer
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
call FarCopyBytes
xor a
ld [wRunningTrainerBattleScript], a
@@ -136,7 +136,7 @@ FacingPlayerDistance_bc::
FacingPlayerDistance::
; Return carry if the sprite at bc is facing the player,
-; and its distance in d.
+; its distance in d, and its direction in e.
ld hl, OBJECT_NEXT_MAP_X ; x
add hl, bc
diff --git a/mobile/mobile_12_2.asm b/mobile/mobile_12_2.asm
index 27d59471a..cd5a7b233 100644
--- a/mobile/mobile_12_2.asm
+++ b/mobile/mobile_12_2.asm
@@ -158,7 +158,7 @@ MobileCheckOwnMonAnywhere:
UnusedFindItemInPCOrBag:
ld a, [wScriptVar]
ld [wCurItem], a
- ld hl, wPCItems
+ ld hl, wNumPCItems
call CheckItem
jr c, .found
diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm
index 7ba1e737f..85773ef4a 100644
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -692,10 +692,10 @@ Function171ccd:
ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
- ld hl, wEngineBuffer5
- ld a, $ff
+ ld hl, wOBPals1 palette 0 color 1
+ ld a, LOW(PALRGB_WHITE)
ld [hli], a
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ld [hl], a
call SetPalettes
pop af
diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm
index d36daca91..48ba99276 100644
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -2664,7 +2664,7 @@ Function17e165:
pop hl
jr c, .asm_17e195
push hl
- ld hl, wPCItems
+ ld hl, wNumPCItems
call CheckItem
pop hl
jr c, .asm_17e195
diff --git a/wram.asm b/wram.asm
index 7fa8363d7..ddd360d73 100644
--- a/wram.asm
+++ b/wram.asm
@@ -755,7 +755,6 @@ wc668:: ds 32
wc688:: ds 2
wc68a:: ds 4
ds 66
-
ENDU ; c6d0
; This union spans 280 bytes from c6d0 to c7e8.
@@ -1765,12 +1764,20 @@ wd036:: ds 2
ds 6
UNION ; d03e
-; engine buffers
-wEngineBuffer1:: db
-wEngineBuffer2:: db
-wEngineBuffer3:: db
-wEngineBuffer4:: db
-wEngineBuffer5:: db
+; trainer data
+wSeenTrainerBank:: db
+wSeenTrainerDistance:: db
+wSeenTrainerDirection:: db
+wTempTrainer::
+wTempTrainerEventFlag:: dw
+wTempTrainerClass:: db
+wTempTrainerID:: db
+wSeenTextPointer:: dw
+wWinTextPointer:: dw
+wLossTextPointer:: dw
+wScriptAfterPointer:: dw
+wRunningTrainerBattleScript:: db
+wTempTrainerEnd::
NEXTU ; d03e
; menu items list
@@ -1783,13 +1790,30 @@ wCurFruitTree:: db
wCurFruit:: db
NEXTU ; d03e
+; item ball data
+wItemBallData::
+wItemBallItemID:: db
+wItemBallQuantity:: db
+wItemBallDataEnd::
+
+NEXTU ; d03e
+; hidden item data
+wHiddenItemData::
+wHiddenItemEvent:: dw
+wHiddenItemID:: db
+wHiddenItemDataEnd::
+
+NEXTU ; d03e
; elevator data
+wElevatorData::
wElevatorPointerBank:: db
wElevatorPointer:: dw
wElevatorOriginFloor:: db
+wElevatorDataEnd::
NEXTU ; d03e
; coord event data
+wCurCoordEvent::
wCurCoordEventSceneID:: db
wCurCoordEventMapY:: db
wCurCoordEventMapX:: db
@@ -1798,6 +1822,7 @@ wCurCoordEventScriptAddr:: dw
NEXTU ; d03e
; BG event data
+wCurBGEvent::
wCurBGEventYCoord:: db
wCurBGEventXCoord:: db
wCurBGEventType:: db
@@ -1805,32 +1830,19 @@ wCurBGEventScriptAddr:: dw
NEXTU ; d03e
; mart data
- ds 1
+wMartType:: db
wMartPointerBank:: db
wMartPointer:: dw
- ds 1
+wMartJumptableIndex:: db
wBargainShopFlags:: db
NEXTU ; d03e
-; trainer data
- ds 3
-wTempTrainer::
-wTempTrainerEventFlag:: dw
-wTempTrainerClass:: db
-wTempTrainerID:: db
-wSeenTextPointer:: dw
-wWinTextPointer:: dw
-wLossTextPointer:: dw
-wScriptAfterPointer:: dw
-wRunningTrainerBattleScript:: db
-wTempTrainerEnd::
-
-NEXTU ; d03e
; player movement data
-wCurInput:: db
-wd03f:: db
-wd040:: db
-wd041:: db
+wCurInput::
+wFacingTileID:: db
+wWalkingIntoNPC:: db
+wWalkingIntoLand:: db
+wWalkingIntoEdgeWarp:: db
wMovementAnimation:: db
wWalkingDirection:: db
wFacingDirection:: db
@@ -1846,17 +1858,32 @@ NEXTU ; d03e
wJumpStdScriptBuffer:: ds 3
NEXTU ; d03e
-; phone script pointer
- ds 10
-wPhoneScriptPointer:: dw
+; phone script data
+wCheckedTime:: db
+wPhoneListIndex:: db
+wNumAvailableCallers:: db
+wAvailableCallers:: ds CONTACT_LIST_SIZE
+
+NEXTU ; d03e
+; phone caller contact
+ ds 1
+wCallerContact:: ds PHONE_CONTACT_SIZE
NEXTU ; d03e
; backup menu data
ds 7
wMenuCursorBufferBackup:: db
wMenuScrollPositionBackup:: db
- ds 31
-ENDU ; d066
+
+NEXTU ; d03e
+; poison step data
+wPoisonStepData::
+wPoisonStepFlagSum:: db
+wPoisonStepPartyFlags:: ds PARTY_LENGTH
+wPoisonStepDataEnd::
+ENDU ; d04f
+
+ ds 23
ENDU ; d066
wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH ; d066
@@ -2513,11 +2540,10 @@ wNumBalls:: db ; d8d7
wBalls:: ds MAX_BALLS * 2 + 1 ; d8d8
wBallsEnd::
+wNumPCItems:: db
wPCItems:: ds MAX_PC_ITEMS * 2 + 1 ; d8f1
wPCItemsEnd::
- ds 1
-
wPokegearFlags::
; bit 0: map
; bit 1: radio