summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-07-04 00:36:30 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-07-04 00:36:30 -0400
commita9e823ffc7b73ab79b8d0d0434968df2576d2a4e (patch)
treec02701945992f0620c9e929596ec0f322b81e960
parente6a2780d7f96d318bd5fb824356f52c65b8398c0 (diff)
Illustrative example
-rw-r--r--Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md10
-rw-r--r--screenshots/redundant-tiles-kanto.pngbin0 -> 1499 bytes
2 files changed, 7 insertions, 3 deletions
diff --git a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
index a3d9d08..a5fad74 100644
--- a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
+++ b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
@@ -1,6 +1,10 @@
Maps in pokecrystal are designed with blocks, not tiles, where each block (aka "metatile") is a 4x4 square of tiles. Each 8x8-pixel tile always has the same appearance in every block. But the GameBoy hardware is capable of more. The same tile graphic can be reused with different attributes—not just color, but X and Y flip, as well as "priority" to appear above sprites.
-This tutorial will show you how to create and use **\*_attributes.bin** files, which assign attributes to the individual tiles of each block. Spoiler: you'll be able to make maps like [this](screenshots/polished-map-redplusplus-goldenrod-city.png).
+For example, here's the `kanto` tileset. The tiles highlighted in fuchsia are just flipped or recolored copies of the ones highlighted in cyan, so by following this tutorial, you can eliminate all those tiles. And with the priority attribute, you can (for instance) let NPCs walk behind the roof tiles highlighted in yellow. (Although if that's all you want to do, just follow [the `PRIORITY` color tutorial](Allow-map-tiles-to-appear-above-sprites-\(so-NPCs-can-walk-behind-tiles\)-with-PRIORITY-colors).)
+
+![Screenshot](screenshots/redundant-tiles-kanto.png)
+
+This tutorial will show you how to switch from per-tile \*_palette_map.asm files to per-block **\*_attributes.bin** files, which assign full attributes (not just colors) to the individual tiles of each block. By the end, you'll be able to make maps like [this](screenshots/polished-map-redplusplus-goldenrod-city.png).
## Contents
@@ -29,7 +33,7 @@ First, a quick overview of how tilesets work:
Anyway, we're going to create **data/tilesets/\*_attributes.bin** files that assign attributes to the blocks. Each block will have 16 bytes declaring the attributes for each of its tiles, from top-left to bottom-right.
-As described in [this `PRIORITY` color tutorial](Allow-map-tiles-to-appear-above-sprites-\(so-NPCs-can-walk-behind-tiles\)-with-PRIORITY-colors), attributes control more than just color. Here's what the eight bits of an attribute byte mean:
+As described in [the `PRIORITY` color tutorial](Allow-map-tiles-to-appear-above-sprites-\(so-NPCs-can-walk-behind-tiles\)-with-PRIORITY-colors), attributes control more than just color. Here's what the eight bits of an attribute byte mean:
- **Bits 0–2 ($00–$07):** The color. You can see the color values in [constants/tileset_constants.asm](../blob/master/constants/tileset_constants.asm).
- **Bit 3 ($08):** The tile bank. The way pokecrystal's tileset system works, tile IDs $80–$FF need this bit set.
@@ -492,7 +496,7 @@ One, [the bug that only allowed 128 blocks](../blob/master/docs/bugs_and_glitche
Two, tile IDs in \*_metatiles.bin have their high bit masked out. That used to be done with `res 7` in `SwapTextboxPalettes` and `ScrollBGMapPalettes`, but we deleted those.
-(Strictly speaking, we could just store values $00–$7F in \*_metatiles.bin to begin with, and rely on bit 3 of the values in \*_attributes.asm to indicate which tile range is being used ($00–$7F or $80–$FF, VRAM bank 0 or 1). But that would break compatibility with Polished Map even worse that it already is, and it would necessitate editing the \*_metatiles.bin files too.)
+(Strictly speaking, we could just store values $00–$7F in \*_metatiles.bin to begin with, and rely on bit 3 of the values in \*_attributes.asm to indicate which tile range is being used ($00–$7F or $80–$FF, VRAM bank 0 or 1). But that would break compatibility with Polished Map even worse than it already is, and it would necessitate editing the \*_metatiles.bin files too.)
```diff
LoadMetatiles::
diff --git a/screenshots/redundant-tiles-kanto.png b/screenshots/redundant-tiles-kanto.png
new file mode 100644
index 0000000..349b58a
--- /dev/null
+++ b/screenshots/redundant-tiles-kanto.png
Binary files differ