diff options
-rw-r--r-- | Edit-the-Town-Map.md | 62 | ||||
-rw-r--r-- | Tutorials.md | 5 | ||||
-rw-r--r-- | screenshots/gfx-pokegear-johto.png | bin | 0 -> 1265 bytes | |||
-rw-r--r-- | screenshots/gfx-pokegear-kanto.png | bin | 0 -> 1380 bytes | |||
-rw-r--r-- | screenshots/gfx-pokegear-town_map.png | bin | 0 -> 660 bytes | |||
-rw-r--r-- | screenshots/hex-edit-attributes.png | bin | 33021 -> 37508 bytes | |||
-rw-r--r-- | screenshots/hex-workshop-johto.png | bin | 0 -> 46653 bytes | |||
-rw-r--r-- | screenshots/hex-workshop-kanto.png | bin | 0 -> 45927 bytes | |||
-rw-r--r-- | screenshots/town-map-vram.png | bin | 0 -> 6529 bytes |
9 files changed, 66 insertions, 1 deletions
diff --git a/Edit-the-Town-Map.md b/Edit-the-Town-Map.md new file mode 100644 index 0000000..c561200 --- /dev/null +++ b/Edit-the-Town-Map.md @@ -0,0 +1,62 @@ +The Town Map is a bit tricky to edit: it's one of the only things in pokecrystal that still requires a hex editor. This tutorial will explain how it works. + + +## TOC + + +## 1. The tileset + +Like everything else on the GameBoy, the Town Map is composed of 8x8-pixel tiles. Its tile graphics are stored in [gfx/pokegear/town_map.png](../blob/master/gfx/pokegear/town_map.png): + + + +You can freely edit this image to change the tiles, but you can't make it larger. That's because all the available tileset space is taken up by Pokégear and font graphics. You can see this in [BGB](http://bgb.bircd.org/)'s VRAM viewer: + + + +(For adding more tiles, there *are* those three unused blank ones on the right side of the tileset.) + + +## 2. The Johto and Kanto tilemaps + +The two regions' maps are actually defined by [gfx/pokegear/johto.bin](../blob/master/gfx/pokegear/johto.bin) and [gfx/pokegear/kanto.bin](../blob/master/gfx/pokegear/kanto.bin). Each of those is a 361-byte binary tilemap: 20x18 bytes covering the entire screen, from top-left to bottom-right, with a $FF at the very end. The bytes are tile IDs, starting at 0. For example, $0A (10 in decimal) is the eleventh tile in the tilemap, the town or city icon. And if you look at where the $0A bytes are in johto.bin and kanto.bin, you'll notice they correspond to the locations of towns and cities. + +If your hex editor supports coloring by value, that can make editing a lot easier. For example, here's Hex Workshop (not a free program) using a custom color map to highlight different tile IDs: + +[](screenshots/hex-workshop-johto.png) + +[](screenshots/hex-workshop-kanto.png) + +Clearly, those bytes represent these Town Maps: + + + + + + +## 3. The landmarks + +Landmarks are defined in [data/maps/landmarks.asm](../blob/master/data/maps/landmarks.asm). Each one has an X coordinate, Y coordinate, and name. The coordinates are in pixels from the top-left corner, but with 8 added to X and 16 added to Y. For example: + +``` + landmark 148, 116, NewBarkTownName + +... + +NewBarkTownName: db "NEW BARK¯TOWN@" +``` + +148 − 8 = 140 and 116 − 16 = 100; and if you look at pixel coordinates (140, 100) in the Johto map above, you'll see it's in the middle of the New Bark Town icon. + +If you're wondering why those offsets exist, it's because of how the GameBoy hardware works. From the [Pan Docs](http://bgb.bircd.org/pandocs.htm#vramspriteattributetableoam): + +> **Byte0 - Y Position** +> Specifies the sprites vertical position on the screen (minus 16). +> An offscreen value (for example, Y=0 or Y>=160) hides the sprite. +> +> **Byte1 - X Position** +> Specifies the sprites horizontal position on the screen (minus 8). +> An offscreen value (X=0 or X>=168) hides the sprite, but the sprite +> still affects the priority ordering - a better way to hide a sprite is to set its Y-coordinate offscreen. + +For more information on editing landmarks, see the tutorial on [how to add a new map and landmark](Add-a-new-map-and-landmark). diff --git a/Tutorials.md b/Tutorials.md index 805e6e9..b9a6362 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -7,6 +7,10 @@ Tutorials may use diff syntax to show edits: ``` +**How to edit the…** + +- [Town Map](Edit-the-Town-Map) + **How to add a new…** - [Map and landmark](Add-a-new-map-and-landmark) @@ -45,7 +49,6 @@ Tutorials may use diff syntax to show edits: **To do:** *(feel free to contribute one of these!)* -- Hex edit the Town Map - Decoration for your room - Spawn point (for Fly or Teleport) - Wild data diff --git a/screenshots/gfx-pokegear-johto.png b/screenshots/gfx-pokegear-johto.png Binary files differnew file mode 100644 index 0000000..493faaa --- /dev/null +++ b/screenshots/gfx-pokegear-johto.png diff --git a/screenshots/gfx-pokegear-kanto.png b/screenshots/gfx-pokegear-kanto.png Binary files differnew file mode 100644 index 0000000..ea14189 --- /dev/null +++ b/screenshots/gfx-pokegear-kanto.png diff --git a/screenshots/gfx-pokegear-town_map.png b/screenshots/gfx-pokegear-town_map.png Binary files differnew file mode 100644 index 0000000..e711c5f --- /dev/null +++ b/screenshots/gfx-pokegear-town_map.png diff --git a/screenshots/hex-edit-attributes.png b/screenshots/hex-edit-attributes.png Binary files differindex 5e15a95..9a2b55e 100644 --- a/screenshots/hex-edit-attributes.png +++ b/screenshots/hex-edit-attributes.png diff --git a/screenshots/hex-workshop-johto.png b/screenshots/hex-workshop-johto.png Binary files differnew file mode 100644 index 0000000..6602f74 --- /dev/null +++ b/screenshots/hex-workshop-johto.png diff --git a/screenshots/hex-workshop-kanto.png b/screenshots/hex-workshop-kanto.png Binary files differnew file mode 100644 index 0000000..83b2e86 --- /dev/null +++ b/screenshots/hex-workshop-kanto.png diff --git a/screenshots/town-map-vram.png b/screenshots/town-map-vram.png Binary files differnew file mode 100644 index 0000000..2b22b56 --- /dev/null +++ b/screenshots/town-map-vram.png |