summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-09-23 13:35:01 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-09-23 13:35:01 -0400
commitd84735b8d237651c656a39a0cfbfe45b5fa5fa23 (patch)
tree87b4ccb2ba9f923be1d88419e1171aa564d0c2e9
parentf329b317299300e3b231979f695d8d6c72642901 (diff)
Fix bug noticed by ShinyDragonHunter
-rw-r--r--Expand-tilesets-from-192-to-255-tiles.md66
1 files changed, 33 insertions, 33 deletions
diff --git a/Expand-tilesets-from-192-to-255-tiles.md b/Expand-tilesets-from-192-to-255-tiles.md
index 3ff50d2..b4e55ad 100644
--- a/Expand-tilesets-from-192-to-255-tiles.md
+++ b/Expand-tilesets-from-192-to-255-tiles.md
@@ -18,7 +18,7 @@ It's fairly simple to use $E0–$FF for 32 more map tiles. We can also use $60β€
5. [Load tile graphics into $60–$7F and $E0–$FF](#5-load-tile-graphics-into-607f-and-e0ff)
6. [Update the tilesets' graphics to not skip $60–$7F](#6-update-the-tilesets-graphics-to-not-skip-607f)
7. [Update the tilesets' palette maps to not skip $60–$7F](#7-update-the-tilesets-palette-maps-to-not-skip-607f)
-8. [Don't hide sprites behind $60–$7F or $E0–$FF](#8-dont-hide-sprites-behind-607f-or-e0ff)
+8. [Don't hide sprites behind $60–$7E or $E0–$FE](#8-dont-hide-sprites-behind-607e-or-e0fe)
9. [Change some hard-coded tile placements](#9-change-some-hard-coded-tile-placements)
10. [Correct other implicit assumptions about tiles](#10-correct-other-implicit-assumptions-about-tiles)
@@ -449,43 +449,43 @@ Here's one example, [gfx/tilesets/johto_modern_palette_map.asm](../blob/master/g
The `ROOF` values are for tiles $60–$7E, which can be used for maps, and the `TEXT` value is for $7F, the space character.
-## 8. Don't hide sprites behind $60–$7F or $E0–$FF
-
-By default, sprites will disappear when they're behind (on top of) tiles $60–$6F or $D0–$FF, as well as the regular font tiles. This is so they won't appear on top of textboxes. We need to change this to hide sprites behind *any* text tile, instead of assuming certain IDs are always for text.
+## 8. Don't hide sprites behind $60–$7E or $E0–$FE
+
+By default, sprites will disappear when they're behind (on top of) tiles $60–$6F or $D0–$FF, as well as the regular font tiles. This is so they won't appear on top of textboxes. This is caused by [engine/overworld/map_objects.asm](../blob/master/engine/overworld/map_objects.asm):
+
+```asm
+Function56cd:
+ ...
+ ld c, a
+ push bc
+ call Coord2Tile
+ pop bc
+; NPCs disappear if standing on tile $60-$7f (or $e0-$ff),
+; since those IDs are for text characters and textbox frames.
+ ld a, [hl]
+ cp FIRST_REGULAR_TEXT_CHAR
+ jr nc, .nope
+.ok8
+ dec d
+ jr nz, .next
+.ok9
+ dec e
+ jr nz, .loop
+ and a
+ ret
+```
-Edit [engine/overworld/map_objects.asm](../blob/master/engine/overworld/map_objects.asm):
+Edit [constants/text_constants.asm](../blob/master/constants/text_constants.asm):
```diff
- Function56cd:
- ...
- ldh a, [hUsedSpriteIndex]
- add d
- dec a
- cp SCREEN_WIDTH
- jr nc, .ok8
- ld c, a
- push bc
-- call Coord2Tile
-+ call Coord2Attr
- pop bc
--; NPCs disappear if standing on tile $60-$7f (or $e0-$ff),
--; since those IDs are for text characters and textbox frames.
- ld a, [hl]
-- cp FIRST_REGULAR_TEXT_CHAR
-- jr nc, .nope
-+ and PALETTE_MASK
-+ cp PAL_BG_TEXT
-+ jr z, .nope
- .ok8
- dec d
- jr nz, .next
- .ok9
- dec e
- jr nz, .loop
- and a
- ret
+-FIRST_REGULAR_TEXT_CHAR EQU $60
++FIRST_REGULAR_TEXT_CHAR EQU $7f
```
+Now tiles $60–$7E and $E0–$FE can safely have NPCs on top of them, but tiles $7F and $FF cannot. Tile $7F is the space character, so that's appropriate, but you'll have to remember not to place any sprites on tile $FF either.
+
+(Until September 23, 2018, this step recommended that you edit [engine/overworld/map_objects.asm](../blob/master/engine/overworld/map_objects.asm), call `Coord2Attr` instead of `Coord2Tile`, and check for the `PAL_BG_TEXT` color attribute instead of the `FIRST_REGULAR_TEXT_CHAR` tile ID. However, as ShinyDragonHunter noticed, this failed under certain circumstances involving the popup map name signs and automatic cutscenesβ€”such as the Tin Tower scene where you battle Suicune.)
+
## 9. Change some hard-coded tile placements