Fix documentation links to work with GitHub Pages

This commit is contained in:
Rangi 2019-03-10 22:43:57 -04:00
parent 388e5a2a78
commit 70ef2f3432
10 changed files with 134 additions and 128 deletions

View File

@ -1,6 +1,6 @@
# Battle Animation Commands # 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/macros/scripts/battle_anims.asm) and [engine/battle_anims/anim_commands.asm:BattleAnimCommands](https://github.com/pret/pokecrystal/engine/battle_anims/anim_commands.asm).
## `$00``$CF`: <code>anim_wait <i>length</i></code> ## `$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*). 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/constants/battle_anim_constants.asm))
- *x*: the x position in pixels - *x*: the x position in pixels
- *y*: the y position in pixels - *y*: the y position in pixels
- *x_tile*: an added x position in tiles (8 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. 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/constants/battle_anim_constants.asm))
Caveats: Caveats:
- These will override any currently-loaded GFX. - 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. 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/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`. 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` ## `$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/engine/battle_anims/pokeball_wobble.asm).
## `$DC`: `anim_transform` ## `$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> ## `$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/constants/battle_anim_constants.asm))
## `$F1`: <code>anim_bgp <i>colors</i></code> ## `$F1`: <code>anim_bgp <i>colors</i></code>

View File

@ -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)) ([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/engine/battle/effect_commands.asm)
```diff ```diff
; Double the stat ; 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)) ([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/engine/battle/effect_commands.asm):
```diff ```diff
ld a, c 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. 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/engine/battle/effect_commands.asm)
```diff ```diff
.finish .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)) ([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/engine/battle/effect_commands.asm):
```diff ```diff
- ; BUG: 1/256 chance to fail even for a 100% effect chance, - ; 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)) ([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/engine/battle/move_effects/belly_drum.asm):
```diff ```diff
BattleCommand_BellyDrum: BattleCommand_BellyDrum:
@ -249,14 +249,14 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
**Fix:** **Fix:**
First, edit [hram.asm](/hram.asm): First, edit [hram.asm](https://github.com/pret/pokecrystal/hram.asm):
```diff ```diff
hClockResetTrigger:: db ; ffeb hClockResetTrigger:: db ; ffeb
+hIsConfusionDamage:: db ; ffec +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/engine/battle/effect_commands.asm):
```diff ```diff
HitSelfInConfusion: HitSelfInConfusion:
@ -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. 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/data/moves/effects.asm):
```diff ```diff
DefenseDownHit: DefenseDownHit:
@ -373,7 +373,7 @@ This bug affects Acid, Iron Tail, and Rock Smash.
([Video](https://www.youtube.com/watch?v=uRYyzKRatFk)) ([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/engine/battle/move_effects/counter.asm) and `BattleCommand_MirrorCoat` in [engine/battle/move_effects/mirror_coat.asm](https://github.com/pret/pokecrystal/engine/battle/move_effects/mirror_coat.asm):
```diff ```diff
- ; BUG: Move should fail with all non-damaging battle actions - ; 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)) ([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/engine/battle/core.asm):
```diff ```diff
.done .done
@ -426,7 +426,7 @@ Add this to the end of each file:
([Video](https://www.youtube.com/watch?v=tiRvw-Nb2ME)) ([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/engine/battle/core.asm)
```diff ```diff
ld a, $f0 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. 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/engine/battle/effect_commands.asm):
```diff ```diff
CheckHiddenOpponent: 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)) ([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/engine/battle/move_effects/beat_up.asm):
```diff ```diff
.got_mon .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. 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/engine/battle/effect_commands.asm):
```diff ```diff
.only_one_beatup .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. 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/engine/battle/effect_commands.asm).
```diff ```diff
cp EFFECT_MULTI_HIT 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). 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/engine/battle/move_effects/beat_up.asm):
```diff ```diff
BattleCommand_BeatUpFailText: 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. 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/engine/battle/move_effects/present.asm):
```diff ```diff
BattleCommand_Present: 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)) ([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/engine/battle/ai/scoring.asm):
```diff ```diff
-; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy). -; 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` ## 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/engine/battle/effect_commands.asm):
```diff ```diff
BattleCheckTypeMatchup: 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)) ([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/engine/battle/ai/items.asm):
```diff ```diff
AI_HealStatus: 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)) ([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/engine/battle/anim_hp_bar.asm):
```diff ```diff
- ; This routine is buggy. The result from ComputeHPBarPixels is stored - ; 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)) ([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/engine/battle/anim_hp_bar.asm):
```diff ```diff
ld b, 0 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. 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/engine/pokemon/experience.asm):
```diff ```diff
CalcExpAtLevel: 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)) ([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/data/text/common_2.asm):
```diff ```diff
Text_ABoostedStringBuffer2ExpPoints:: 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 ## 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/engine/items/item_effects.asm):
```diff ```diff
-; This routine is buggy. It was intended that SLP and FRZ provide a higher -; 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 ## 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/engine/items/item_effects.asm):
```diff ```diff
-; Moon Stone's constant from Pokémon Red is used. -; 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 ## 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/engine/items/item_effects.asm):
```diff ```diff
.wildmale .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 ## 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/engine/items/item_effects.asm):
```diff ```diff
.loop .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.* *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/data/items/attributes.asm):
```diff ```diff
; DRAGON_FANG ; 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)) ([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/maps/DragonsDen1F.asm):
```diff ```diff
- db 0 ; callbacks - 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 ## 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/engine/events/haircut.asm):
```asm ```asm
; Bug: Subtracting $ff from $ff fails to set c. ; Bug: Subtracting $ff from $ff fails to set c.
@ -958,7 +958,7 @@ CopyPokemonName_Buffer1_Buffer3:
jp CopyBytes 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/data/events/happiness_probabilities.asm):
```diff ```diff
HappinessData_DaisysGrooming: HappinessData_DaisysGrooming:
@ -970,7 +970,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp in Lake of Rage are shorter, not longer ## 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/engine/battle/core.asm):
```diff ```diff
.CheckMagikarpArea: .CheckMagikarpArea:
@ -1000,7 +1000,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp length limits have a unit conversion error ## 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/engine/battle/core.asm):
```diff ```diff
; Get Magikarp's length ; Get Magikarp's length
@ -1040,7 +1040,7 @@ CopyPokemonName_Buffer1_Buffer3:
## Magikarp lengths can be miscalculated ## 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/engine/events/magikarp.asm):
```diff ```diff
.BCLessThanDE: .BCLessThanDE:
@ -1068,7 +1068,7 @@ There are three things wrong here:
**Fix:** **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/engine/battle/battle_transition.asm):
```diff ```diff
StartTrainerBattle_DetermineWhichAnimation: StartTrainerBattle_DetermineWhichAnimation:
@ -1130,7 +1130,7 @@ First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transiti
db BATTLETRANSITION_NO_CAVE_STRONGER 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/engine/battle/start_battle.asm):
```diff ```diff
FindFirstAliveMonAndStartBattle: FindFirstAliveMonAndStartBattle:
@ -1157,7 +1157,7 @@ Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
predef DoBattleTransition 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/engine/battle/read_trainer_party.asm):
```diff ```diff
INCLUDE "data/trainers/parties.asm" 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)) ([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/engine/events/halloffame.asm):
```diff ```diff
ld a, [wHallOfFameTempWinCount] 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)) ([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/engine/games/slot_machine.asm):
```diff ```diff
.okay .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 ## 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/engine/battle/start_battle.asm):
```diff ```diff
ld de, MUSIC_ROCKET_BATTLE ld de, MUSIC_ROCKET_BATTLE
@ -1270,7 +1270,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
## No bump noise if standing on tile `$3E` ## 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/engine/overworld/player_movement.asm):
```diff ```diff
.CheckWarp: .CheckWarp:
@ -1307,7 +1307,7 @@ Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer
The exact cause of this bug is unknown. 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/engine/pokedex/pokedex.asm):
```diff ```diff
.Cry: .Cry:
@ -1325,31 +1325,31 @@ The exact cause of this bug is unknown.
## In-battle “`…`” ellipsis is too high ## 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/gfx/battle/hp_exp_bar_border.png):
![image](/gfx/battle/hp_exp_bar_border.png) ![image](https://github.com/pret/pokecrystal/gfx/battle/hp_exp_bar_border.png)
**Fix:** Lower the ellipsis by two pixels: **Fix:** Lower the ellipsis by two pixels:
![image](/docs/images/hp_exp_bar_border.png) ![image](https://github.com/pret/pokecrystal/docs/images/hp_exp_bar_border.png)
## Two tiles in the `port` tileset are drawn incorrectly ## 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/gfx/tilesets/port.png):
![image](/gfx/tilesets/port.png) ![image](https://github.com/pret/pokecrystal/gfx/tilesets/port.png)
**Fix:** Adjust them to match the right-hand corner tiles: **Fix:** Adjust them to match the right-hand corner tiles:
![image](/docs/images/port.png) ![image](https://github.com/pret/pokecrystal/docs/images/port.png)
## `LoadMetatiles` wraps around past 128 blocks ## `LoadMetatiles` wraps around past 128 blocks
This bug prevents you from using blocksets with more than 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/home/map.asm):
```diff ```diff
; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles). ; 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:** **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/engine/events/overworld.asm):
```diff ```diff
UsedSurfScript: UsedSurfScript:
@ -1399,7 +1399,7 @@ First, edit `UsedSurfScript` in [engine/events/overworld.asm](/engine/events/ove
end 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/engine/overworld/player_object.asm):
```diff ```diff
SurfStartStep: 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 ## 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/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/engine/overworld/npc_movement.asm):
```diff ```diff
ld hl, OBJECT_FLAGS1 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. 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/engine/pokemon/search.asm):
```diff ```diff
; check OT ; 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. 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/engine/items/item_effects.asm):
```diff ```diff
ld hl, wEnemySubStatus5 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)) ([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/engine/items/item_effects.asm):
```diff ```diff
.room_in_party .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 ## `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/engine/items/item_effects.asm):
```diff ```diff
- ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway. - ; 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 ## 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/engine/pokemon/party_menu.asm):
```diff ```diff
.DetermineCompatibility: .DetermineCompatibility:
@ -1600,7 +1600,7 @@ This supports up to six entries.
## `EVOLVE_STAT` can break Stone compatibility reporting ## `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/engine/pokemon/party_menu.asm):
```diff ```diff
.loop2 .loop2
@ -1620,7 +1620,7 @@ This supports up to six entries.
## `ScriptCall` can overflow `wScriptStack` and crash ## `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/engine/overworld/scripting.asm):
```diff ```diff
ScriptCall: ScriptCall:
@ -1663,7 +1663,7 @@ This supports up to six entries.
## `LoadSpriteGFX` does not limit the capacity of `UsedSprites` ## `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/engine/overworld/overworld.asm):
```diff ```diff
LoadSpriteGFX: LoadSpriteGFX:
@ -1699,7 +1699,7 @@ This supports up to six entries.
## `ChooseWildEncounter` doesn't really validate the wild Pokémon species ## `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/engine/overworld/wildmons.asm):
```diff ```diff
.ok .ok
@ -1718,7 +1718,7 @@ This supports up to six entries.
## `TryObjectEvent` arbitrary code execution ## `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/engine/overworld/events.asm):
```diff ```diff
-; Bug: If IsInArray returns nc, data at bc will be executed as code. -; 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 ## `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/home/init.asm):
```diff ```diff
ClearWRAM:: ClearWRAM::
@ -1771,7 +1771,7 @@ This supports up to six entries.
## `BattleAnimCmd_ClearObjs` only clears the first 6⅔ objects ## `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/engine/battle_anims/anim_commands.asm):
```diff ```diff
BattleAnimCmd_ClearObjs: BattleAnimCmd_ClearObjs:

View File

@ -1,6 +1,6 @@
# Design Flaws # 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/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 ## 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` ## 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/data/pokemon/pic_pointers.asm), [data/pokemon/unown_pic_pointers.asm](https://github.com/pret/pokecrystal/data/pokemon/unown_pic_pointers.asm), and [data/trainers/pic_pointers.asm](https://github.com/pret/pokecrystal/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/macros/data.asm) that offsets banks by `PICS_FIX`:
```asm ```asm
dba_pic: MACRO ; dbw bank, address dba_pic: MACRO ; dbw bank, address
@ -26,7 +26,7 @@ dba_pic: MACRO ; dbw bank, address
ENDM 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/engine/gfx/load_pics.asm):
```asm ```asm
FixPicBank: FixPicBank:
@ -74,14 +74,14 @@ GLOBAL PICS_FIX
db BANK("Pics 24") ; BANK("Pics 1") + 23 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/engine/gfx/load_pics.asm). Then use `dba` instead of `dba_pic` everywhere.
## `PokemonPicPointers` and `UnownPicPointers` are assumed to start at the same address ## `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/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/gfx/pics.asm):
```asm ```asm
; PokemonPicPointers and UnownPicPointers are assumed to start at the same ; 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" INCLUDE "data/pokemon/unown_pic_pointers.asm"
``` ```
In [pokecrystal.link](/pokecrystal.link): In [pokecrystal.link](https://github.com/pret/pokecrystal/pokecrystal.link):
``` ```
ROMX $48 ROMX $48
@ -113,7 +113,7 @@ ROMX $49
**Fix:** **Fix:**
Don't enforce `org $4000` in [pokecrystal.link](/pokecrystal.link). Don't enforce `org $4000` in [pokecrystal.link](https://github.com/pret/pokecrystal/pokecrystal.link).
Edit `GetFrontpicPointer`: Edit `GetFrontpicPointer`:
@ -160,7 +160,7 @@ And `GetMonBackpic`:
## Footprints are split into top and bottom halves ## Footprints are split into top and bottom halves
In [gfx/footprints.asm](/gfx/footprints.asm): In [gfx/footprints.asm](https://github.com/pret/pokecrystal/gfx/footprints.asm):
```asm ```asm
; Footprints are 2x2 tiles each, but are stored as a 16x64-tile image ; 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/engine/pokedex/pokedex.asm) has to load the halves separately.
**Fix:** **Fix:**
@ -240,13 +240,13 @@ Edit `Pokedex_LoadAnyFootprint`:
## Music IDs $64 and $80 or above have special behavior ## 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/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/master/home/map.asm).
**Fix:** **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/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/master/constants/music_constants.asm):
```diff ```diff
-; GetMapMusic picks music for this value (see home/map.asm) -; 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 ## `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/constants/item_constants.asm) defined the 50 TMs in order with `add_tm`, but `ITEM_C3` and `ITEM_DC` break up that sequence.
```asm ```asm
add_tm DYNAMICPUNCH ; bf add_tm DYNAMICPUNCH ; bf
@ -335,7 +335,7 @@ Edit `GetMapMusic`:
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC 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/engine/items/items.asm) have to compensate for this.
> There was originally a good reason for these two gaps! > 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 Dragonair's catch rate became 27 = $1B for `PROTEIN`
> - Wild Dragonite's catch rate became 9 = $09 for `ANTIDOTE` > - 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/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. > 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. 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/engine/items/items.asm):
```diff ```diff
GetTMHMNumber:: GetTMHMNumber::
@ -411,9 +411,9 @@ Edit [engine/items/items.asm](/engine/items/items.asm):
## Pokédex entry banks are derived from their species IDs ## 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/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/engine/pokedex/pokedex_2.asm):
```asm ```asm
GetDexEntryPointer: GetDexEntryPointer:
@ -449,7 +449,7 @@ GetDexEntryPointer:
db BANK("Pokedex Entries 193-251") 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/engine/items/item_effects.asm):
```asm ```asm
GetPokedexEntryBank: GetPokedexEntryBank:
@ -475,7 +475,7 @@ GetPokedexEntryBank:
db BANK("Pokedex Entries 193-251") 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/engine/pokegear/radio.asm):
```asm ```asm
PokedexShow_GetDexEntryBank: PokedexShow_GetDexEntryBank:
@ -502,12 +502,12 @@ PokedexShow_GetDexEntryBank:
db BANK("Pokedex Entries 193-251") 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/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/home.asm) so it can be called from any bank.)
## Identical sine wave code and data is repeated five times ## 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/engine/math/sine.asm):
```asm ```asm
_Sine:: _Sine::
@ -516,7 +516,7 @@ _Sine::
calc_sine_wave 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/engine/gfx/sprites.asm):
```asm ```asm
Sprites_Cosine: Sprites_Cosine:
@ -528,7 +528,7 @@ Sprites_Sine:
calc_sine_wave 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/engine/battle_anims/functions.asm):
```asm ```asm
BattleAnim_Cosine: BattleAnim_Cosine:
@ -545,14 +545,14 @@ BattleAnimSineWave:
sine_table 32 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/engine/battle/battle_transition.asm):
```asm ```asm
StartTrainerBattle_DrawSineWave: StartTrainerBattle_DrawSineWave:
calc_sine_wave 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/engine/events/celebi.asm):
```asm ```asm
CelebiEvent_Cosine: CelebiEvent_Cosine:
@ -561,7 +561,7 @@ CelebiEvent_Cosine:
calc_sine_wave 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/macros/code.asm):
```asm ```asm
calc_sine_wave: MACRO calc_sine_wave: MACRO
@ -612,7 +612,7 @@ endc
ENDM 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/macros/data.asm):
```asm ```asm
sine_table: MACRO sine_table: MACRO
@ -625,12 +625,12 @@ endr
ENDM 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/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 ## `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/engine/tilesets/tileset_anims.asm) is hilariously inefficient.
**Fix:** **Fix:**

View File

@ -1,6 +1,6 @@
# Event Commands # 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/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](https://github.com/pret/pokecrystal/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. 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.

View File

@ -1,22 +1,28 @@
Issues with the pokecrystal source code: 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/README.md) and [wiki](https://github.com/pret/pokecrystal/wiki).
- [bugs_and_glitches.md](/docs/bugs_and_glitches.md)
- [design_flaws.md](/docs/design_flaws.md)
Map event scripts: ## Issues with the source code
- [map_event_scripts.md](/docs/map_event_scripts.md) - [bugs_and_glitches.md](https://github.com/pret/pokecrystal/docs/bugs_and_glitches.md)
- [event_commands.md](/docs/event_commands.md) - [design_flaws.md](https://github.com/pret/pokecrystal/docs/design_flaws.md)
- [movement_commands.md](/docs/movement_commands.md)
- [text_commands.md](/docs/text_commands.md)
Other types of scripts:
- [battle_anim_commands.md](/docs/battle_anim_commands.md) ## Map event scripts
- [move_effect_commands.md](/docs/move_effect_commands.md)
- [music_commands.md](/docs/music_commands.md)
And other subsystems: - [map_event_scripts.md](https://github.com/pret/pokecrystal/docs/map_event_scripts.md)
- [event_commands.md](https://github.com/pret/pokecrystal/docs/event_commands.md)
- [movement_commands.md](https://github.com/pret/pokecrystal/docs/movement_commands.md)
- [text_commands.md](https://github.com/pret/pokecrystal/docs/text_commands.md)
- [pic_animations.md](/docs/pic_animations.md)
- [menus.md](/docs/menus.md) ## Other types of scripts
- [battle_anim_commands.md](https://github.com/pret/pokecrystal/docs/battle_anim_commands.md)
- [move_effect_commands.md](https://github.com/pret/pokecrystal/docs/move_effect_commands.md)
- [music_commands.md](https://github.com/pret/pokecrystal/docs/music_commands.md)
## Other subsystems
- [pic_animations.md](https://github.com/pret/pokecrystal/docs/pic_animations.md)
- [menus.md](https://github.com/pret/pokecrystal/docs/menus.md)

View File

@ -1,6 +1,6 @@
# Move Effect Commands # 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/macros/scripts/battle_commands.asm) and [data/battle/effect_command_pointers.asm:BattleCommandPointers](https://github.com/pret/pokecrystal/data/battle/effect_command_pointers.asm).
## `$01`: `checkturn` ## `$01`: `checkturn`

View File

@ -1,6 +1,6 @@
# Movement Commands # 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/macros/scripts/movement.asm) and [engine/overworld/movement.asm:MovementPointers](https://github.com/pret/pokecrystal/engine/overworld/movement.asm).
## `$00``$03`: <code>turn_head <i>direction</i></code> ## `$00``$03`: <code>turn_head <i>direction</i></code>

View File

@ -1,6 +1,6 @@
# Music Commands # 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/macros/scripts/audio.asm) and [audio/engine.asm:MusicCommands](https://github.com/pret/pokecrystal/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/wiki/Sound-Engine-Commands)*

View File

@ -1,6 +1,6 @@
# Pic Animations # 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/macros/scripts/gfx_anims.asm).
Pic animations are assembled in 3 parts: Pic animations are assembled in 3 parts:
@ -19,12 +19,12 @@ Pic animations are assembled in 3 parts:
Animation data is in these files: Animation data is in these files:
- [gfx/pokemon/anims.asm](/gfx/pokemon/anims.asm): - [gfx/pokemon/anims.asm](https://github.com/pret/pokecrystal/gfx/pokemon/anims.asm):
Main animations (played everywhere) Main animations (played everywhere)
- [gfx/pokemon/idles.asm](/gfx/pokemon/idles.asm): - [gfx/pokemon/idles.asm](https://github.com/pret/pokecrystal/gfx/pokemon/idles.asm):
Idle animations, appended to the main animation. Idle animations, appended to the main animation.
Used in the status screen (blinking, tail wags etc.) 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/gfx/pokemon/unown_anims.asm) and [gfx/pokemon/unown_idles.asm](https://github.com/pret/pokecrystal/gfx/pokemon/unown_idles.asm):
Unown has its own animation data despite having an entry in the main tables. Unown has its own animation data despite having an entry in the main tables.

View File

@ -1,6 +1,6 @@
# Text Commands # 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/macros/scripts/text.asm) and [home/text.asm:TextCommands](https://github.com/pret/pokecrystal/home/text.asm).
## `$00`: `text_start` ## `$00`: `text_start`
@ -108,7 +108,7 @@ Play `SFX_SLOT_MACHINE_START`.
## `$14`: <code>text_buffer <i>id</i></code> ## `$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/data/text_buffers.asm)):
0. `StringBuffer3` 0. `StringBuffer3`
1. `StringBuffer4` 1. `StringBuffer4`