summaryrefslogtreecommitdiff
path: root/docs/bugs_and_glitches.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/bugs_and_glitches.md')
-rw-r--r--docs/bugs_and_glitches.md66
1 files changed, 33 insertions, 33 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 5abf9d08a..d79f386a8 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -51,7 +51,7 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th
- [`LoadSpriteGFX` does not limit the capacity of `UsedSprites`](#loadspritegfx-does-not-limit-the-capacity-of-usedsprites)
- [`ChooseWildEncounter` doesn't really validate the wild Pokémon species](#choosewildencounter-doesnt-really-validate-the-wild-pokémon-species)
- [`TryObjectEvent` arbitrary code execution](#tryobjectevent-arbitrary-code-execution)
-- [`Special_CheckBugContestContestantFlag` can read beyond its data table](#special_checkbugcontestcontestantflag-can-read-beyond-its-data-table)
+- [`CheckBugContestContestantFlag` can read beyond its data table](#checkbugcontestcontestantflag-can-read-beyond-its-data-table)
- [`ClearWRAM` only clears WRAM bank 1](#clearwram-only-clears-wram-bank-1)
@@ -155,7 +155,7 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en
([Video](https://www.youtube.com/watch?v=zuCLMikWo4Y))
-This is a bug with `BattleCommand_BellyDrum` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+This is a bug with `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm):
```asm
BattleCommand_BellyDrum: ; 37c1a
@@ -307,7 +307,7 @@ CheckHiddenOpponent: ; 37daa
([Video](https://www.youtube.com/watch?v=202-iAsrIa8))
-This is a bug with `BattleCommand_BeatUp` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
+This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm):
```asm
.got_mon
@@ -346,7 +346,7 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/effect_commands.asm]
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 is a bug with `BattleCommand_Present` in [engine/battle/effect_commands/present.asm](/engine/battle/effect_commands/present.asm):
+This is a bug with `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm):
```asm
BattleCommand_Present: ; 37874
@@ -712,12 +712,12 @@ This is a bug with `ItemAttributes` in [items/attributes.asm](/items/attributes.
## Daisy's grooming doesn't always increase happiness
-This is a bug with `MassageOrHaircut` in [engine/events/special.asm](/engine/events/special.asm):
+This is a bug with `HaircutOrGrooming` in [engine/events/special.asm](/engine/events/special.asm):
```asm
; Bug: Subtracting $ff from $ff fails to set c.
; This can result in overflow into the next data array.
-; In the case of getting a massage from Daisy, we bleed
+; In the case of getting a grooming from Daisy, we bleed
; into CopyPokemonName_Buffer1_Buffer3, which passes
; $d0 to ChangeHappiness and returns $73 to the script.
; The end result is that there is a 0.4% chance your
@@ -740,8 +740,7 @@ This is a bug with `MassageOrHaircut` in [engine/events/special.asm](/engine/eve
...
-Data_DaisyMassage: ; 746b
- db $ff, 2, HAPPINESS_MASSAGE ; 99.6% chance
+INCLUDE "data/events/happiness_chances.asm"
CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, StringBuffer1
@@ -750,12 +749,19 @@ CopyPokemonName_Buffer1_Buffer3: ; 746e
jp CopyBytes
```
+In [data/events/happiness_chances.asm](/data/events/happiness_chances.asm):
+
+```asm
+HappinessData_DaisysGrooming: ; 746b
+ db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance
+```
+
**Fix:**
```asm
-Data_DaisyMassage: ; 746b
- db $80, 2, HAPPINESS_MASSAGE ; 50% chance
- db $ff, 2, HAPPINESS_MASSAGE ; 50% chance
+HappinessData_DaisysGrooming: ; 746b
+ db $80, 2, HAPPINESS_GROOMING ; 50% chance
+ db $ff, 2, HAPPINESS_GROOMING ; 50% chance
```
@@ -863,10 +869,10 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
jr nc, .okay
set 0, e
.okay
- ld a, [wPermission]
+ ld a, [wEnvironment]
cp CAVE
jr z, .okay2
- cp PERM_5
+ cp ENVIRONMENT_5
jr z, .okay2
cp DUNGEON
jr z, .okay2
@@ -1075,7 +1081,7 @@ In [home/map.asm](/home/map.asm):
## `Function6ec1` does not correctly limit object movement
-This bug is why the Lapras in Union Cave, which uses `SPRITEMOVEDATA_LAPRAS`, is not restricted by its `1, 1` movement radius.
+This bug is why the Lapras in Union Cave, which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius.
In [engine/npc_movement.asm](/engine/npc_movement.asm):
@@ -1104,7 +1110,7 @@ In [engine/search.asm](/engine/search.asm):
ld hl, PlayerName
-rept NAME_LENGTH_JAPANESE +- 2 ; should be PLAYER_NAME_LENGTH +- 2
+rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2
ld a, [de]
cp [hl]
jr nz, .notfound
@@ -1126,7 +1132,7 @@ endr
ret
```
-**Fix:** Change `rept NAME_LENGTH_JAPANESE +- 2` to `rept PLAYER_NAME_LENGTH +- 2`.
+**Fix:** Change `rept NAME_LENGTH_JAPANESE + -2` to `rept PLAYER_NAME_LENGTH + -2`.
## Catching a Transformed Pokémon always catches a Ditto
@@ -1268,11 +1274,11 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
ld l, a
ld de, StringBuffer1
ld a, BANK(EvosAttacks)
- ld bc, $a
+ ld bc, 10
call FarCopyBytes
```
-**Fix:** Change `ld bc, $a` to `ld bc, $10` to support up to five Stone entries.
+**Fix:** Change `ld bc, 10` to `ld bc, StringBuffer2 - StringBuffer1` to support up to six Stone entries.
## `ScriptCall` can overflow `wScriptStack` and crash
@@ -1312,6 +1318,8 @@ ScriptCall:
ret
```
+*To do:* Fix this bug.
+
## `LoadSpriteGFX` does not limit the capacity of `UsedSprites`
@@ -1417,15 +1425,16 @@ In [engine/events.asm](/engine/events.asm):
**Fix:** Uncomment `pop bc`.
-## `Special_CheckBugContestContestantFlag` can read beyond its data table
+## `CheckBugContestContestantFlag` can read beyond its data table
In [engine/events/bug_contest/contest_2.asm](/engine/events/bug_contest/contest_2.asm):
```asm
-Special_CheckBugContestContestantFlag: ; 139ed
+CheckBugContestContestantFlag: ; 139ed
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
-; Bug: If a >= 10 when this is called, it will read beyond the table.
+; Bug: If a >= NUM_BUG_CONTESTANTS when this is called,
+; it will read beyond the table.
ld hl, BugCatchingContestantEventFlagTable
ld e, a
@@ -1440,20 +1449,11 @@ Special_CheckBugContestContestantFlag: ; 139ed
ret
; 139fe
-BugCatchingContestantEventFlagTable: ; 139fe
- dw EVENT_BUG_CATCHING_CONTESTANT_1A
- dw EVENT_BUG_CATCHING_CONTESTANT_2A
- dw EVENT_BUG_CATCHING_CONTESTANT_3A
- dw EVENT_BUG_CATCHING_CONTESTANT_4A
- dw EVENT_BUG_CATCHING_CONTESTANT_5A
- dw EVENT_BUG_CATCHING_CONTESTANT_6A
- dw EVENT_BUG_CATCHING_CONTESTANT_7A
- dw EVENT_BUG_CATCHING_CONTESTANT_8A
- dw EVENT_BUG_CATCHING_CONTESTANT_9A
- dw EVENT_BUG_CATCHING_CONTESTANT_10A
-; 13a12
+INCLUDE "data/events/bug_contest_flags.asm"
```
+However, `a < NUM_BUG_CONTESTANTS` should always be true, so in practice this is not a problem.
+
## `ClearWRAM` only clears WRAM bank 1