summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2017-12-12 23:05:30 -0500
committerRemy Oukaour <remy.oukaour@gmail.com>2017-12-12 23:05:30 -0500
commit138abd097d431bcb657b7842623ea6f36b8f287c (patch)
treed581cb7a658b84e79dd8b334438df6c6014fa7eb
parent10eb426e40f48df3ae9b40e3ea3aa7e92f890090 (diff)
Document one more bug.
-rw-r--r--docs/bugs_and_glitches.md (renamed from docs/bugs.md)28
-rw-r--r--home/map.asm5
2 files changed, 31 insertions, 2 deletions
diff --git a/docs/bugs.md b/docs/bugs_and_glitches.md
index a375fd6fb..6f27f6087 100644
--- a/docs/bugs.md
+++ b/docs/bugs_and_glitches.md
@@ -598,7 +598,7 @@ This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [battle/core.asm](battle/
This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle_start.asm](engine/battle_start.asm):
-```
+```asm
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
; The screen flashes a different number of times depending on the level of
; your lead Pokemon relative to the opponent's.
@@ -683,6 +683,32 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](
```
+## `LoadMetatiles` wrap around past 128 blocks
+
+[home/map.asm](home/map.asm):
+
+```asm
+ ; Set hl to the address of the current metatile data ([TilesetBlocksAddress] + (a) tiles).
+ ; This is buggy; it wraps around past 128 blocks.
+ ; To fix, uncomment the line below.
+ add a ; Comment or delete this line to fix the above bug.
+ ld l, a
+ ld h, 0
+ ; add hl, hl
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ ld a, [TilesetBlocksAddress]
+ add l
+ ld l, a
+ ld a, [TilesetBlocksAddress + 1]
+ adc h
+ ld h, a
+```
+
+**Fix:** Delete `add a` and uncomment `add hl, hl`.
+
+
## Surfing directly across a map connection does not load the new map
([Video](https://www.youtube.com/watch?v=XFOWvMNG-zw))
diff --git a/home/map.asm b/home/map.asm
index 6e0e6e3a9..8b6d8f1e4 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -152,9 +152,12 @@ LoadMetatiles:: ; 2198
ld e, l
ld d, h
; Set hl to the address of the current metatile data ([TilesetBlocksAddress] + (a) tiles).
- add a
+ ; This is buggy; it wraps around past 128 blocks.
+ ; To fix, uncomment the line below.
+ add a ; Comment or delete this line to fix the above bug.
ld l, a
ld h, 0
+ ; add hl, hl
add hl, hl
add hl, hl
add hl, hl