summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-04-09 08:55:54 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-04-09 08:55:54 -0400
commitd54d81b68db5e726dec1ef5438c3af06d1a1df3d (patch)
treec8511e7085dbc6b9c8f600ed48413e4c46fd8b88
parent7a18d8bc072b4c3ae47b366a666f6b135be3b88d (diff)
Fix
-rw-r--r--Wall-to-wall-carpeting-in-your-room.md46
1 files changed, 25 insertions, 21 deletions
diff --git a/Wall-to-wall-carpeting-in-your-room.md b/Wall-to-wall-carpeting-in-your-room.md
index b939be5..6bfe133 100644
--- a/Wall-to-wall-carpeting-in-your-room.md
+++ b/Wall-to-wall-carpeting-in-your-room.md
@@ -27,6 +27,24 @@ Let's say we want wall-to-wall carpeting, covering every square ~~inch~~ tile of
All the graphics for tiles and sprites are stored in video memory, or VRAM. This RAM can only be written to at certain times (namely during H-blank, V-blank, or when the LCD display is disabled); but all we need to know is that at *some* point, the tileset graphics get copied from ROM to RAM, one byte at a time. That's when we can (a) overwrite the floor tile with the carpet tile, and (b) overwrite specific pixels of the desk, table, and plant tiles, so it looks like the carpet texture is peeking out from under them.
+Edit [wram.asm](../blob/master/wram.asm):
+
+```diff
+ wHPPals:: ds PARTY_LENGTH
+ wCurHPPal:: db
+
+- ds 7
++ ds 4
++
++wCarpetTile:: db
++wFloorTile:: db
++wCoveredTile:: db
+
+ wSGBPals:: ds 48 ; cda9
+```
+
+We'll need those three bytes later, so we've defined them in some unused space in WRAM0.
+
Edit [constants/map_setup_constants.asm](../blob/master/constants/map_setup_constants.asm):
```diff
@@ -50,11 +68,13 @@ Edit [home/map.asm](../blob/master/home/map.asm):
farcall LoadMapGroupRoof
.skip_roof
-+ ld a, MAPCALLBACK_GRAPHICS
-+ call RunMapCallback
-+
xor a
ldh [hTileAnimFrame], a
++ ld [wCarpetTile], a
++ ld [wFloorTile], a
++
++ ld a, MAPCALLBACK_GRAPHICS
++ call RunMapCallback
ret
```
@@ -99,6 +119,8 @@ Each type of callback is called at a specific point in the map setup process. If
We just defined a new type of callback that runs right after the tileset graphics have all been loaded; and the player's room is using that type of callback to run `special CoverTilesWithCarpet`. When we get around to defining that, it will be like `special ToggleMaptileDecorations`, but for just the carpet instead of all the other tile-based decorations.
+`LoadTilesetGFX` initializes `[wCarpetTile]` and `[wFloorTile]` to 0, and the `CoverTilesWithCarpet` will also update those values. (We'll see what they're used for later.)
+
Before that, let's remove the current method of placing the carpet.
@@ -312,24 +334,6 @@ Edit [data/special_pointers.asm](../blob/master/data/special_pointers.asm):
Now that `special CoverTilesWithCarpet` script command will do the right thing.
-Then edit [wram.asm](../blob/master/wram.asm):
-
-```diff
- wHPPals:: ds PARTY_LENGTH
- wCurHPPal:: db
-
-- ds 7
-+ ds 4
-+
-+wCarpetTile:: db
-+wFloorTile:: db
-+wCoveredTile:: db
-
- wSGBPals:: ds 48 ; cda9
-```
-
-We'll need those three bytes while placing the carpet pixels, so we've defined them in some unused space in WRAM0.
-
Edit [engine/overworld/decorations.asm](../blob/master/engine/overworld/decorations.asm) again, adding this to the end of the file:
```diff