summaryrefslogtreecommitdiff
path: root/Edit-the-Town-Map.md
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2019-09-02 16:30:35 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2019-09-02 16:30:35 -0400
commitf2315e7c6b6ee17438fa3271bed7221016974d61 (patch)
tree9bccb5d2a28ce8d421a8353b09cac35468064661 /Edit-the-Town-Map.md
parentf4bd32572bab337af0c9180b04f0e173d5ba287e (diff)
Tilemap Studio
Diffstat (limited to 'Edit-the-Town-Map.md')
-rw-r--r--Edit-the-Town-Map.md54
1 files changed, 11 insertions, 43 deletions
diff --git a/Edit-the-Town-Map.md b/Edit-the-Town-Map.md
index 3acdda0..5831543 100644
--- a/Edit-the-Town-Map.md
+++ b/Edit-the-Town-Map.md
@@ -1,4 +1,4 @@
-The Town Map is a bit tricky to edit: it's one of the only things in pokecrystal that still requires a hex editor. (Some free hex editors for Windows are [FlexHEX](http://www.flexhex.com/), [HxD](https://mh-nexus.de/en/hxd/), [Frhed](http://frhed.sourceforge.net/en/), [wxMEdit](https://wxmedit.github.io/), [Catch22 HexEdit](https://www.catch22.net/software/hexedit), or [wxHexEditor](https://www.wxhexeditor.org/).) This tutorial will explain how it works.
+The Town Map's in-game appearance depends on a few files: the tileset image, the color palette, and the tilemap. This tutorial will explain how it works.
## Contents
@@ -7,8 +7,7 @@ The Town Map is a bit tricky to edit: it's one of the only things in pokecrystal
2. [The color palettes](#2-the-color-palettes)
3. [The Johto and Kanto tilemaps](#3-the-johto-and-kanto-tilemaps)
4. [The landmarks](#4-the-landmarks)
-5. [GSC Town Map Editor](#5-gsc-town-map-editor)
-6. [Remove the gray border for more map area](#6-remove-the-gray-border-for-more-map-area)
+5. [Remove the gray border for more map area](#5-remove-the-gray-border-for-more-map-area)
## 1. The tileset
@@ -37,19 +36,19 @@ Anyway, [gfx/pokegear/town_map_palette_map.asm](../blob/master/gfx/pokegear/town
## 3. 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.
+The two regions' maps are defined in [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](http://www.hexworkshop.com/) (not a free program) using a custom color map to highlight different tile IDs:
+Luckily, we don't actually need to think about byte values. Until September 2019, it required a hex editor to edit the tilemap files, but that was inconvenient. So we'll use [Tilemap Studio](https://github.com/Rangi42/tilemap-studio), a program for Windows or Linux that can edit tilemaps, including these $FF-terminated ones.
-[![Screenshot](screenshots/hex-workshop-johto.png)](screenshots/hex-workshop-johto.png)
+To install Tilemap Studio, just follow the instructions in its [INSTALL.md](https://github.com/Rangi42/tilemap-studio/blob/master/INSTALL.md): download install.bat and tilemapstudio.exe from the latest release; run install.bat with admin privileges; and delete the downloaded files, since a shortcut to the installed copy of Tilemap Studio should now exist on your Desktop. If you need help using it, read the documentation in the Help menu.
-[![Screenshot](screenshots/hex-workshop-kanto.png)](screenshots/hex-workshop-kanto.png)
+Anyway, pick the GSC Town Map format, open the johto.bin or kanto.bin tilemap, and load the town_map.png tileset. Then place the tiles however you want and save the edited Town Map. That's all!
-Clearly, those bytes represent these Town Maps:
+...Actually, there's one catch. Tilemap Studio doesn't understand the palette data, so it shows the tileset in grayscale. It would be nice to edit the Town Map in color. Luckily, Tilemap Studio comes with some example files, including a colored Town Map tileset: [example/pokecrystal/town_map_pokegear.png](https://github.com/Rangi42/tilemap-studio/blob/master/example/pokecrystal/town_map_pokegear.png). Load that instead of gfx/pokegear/town_map.png (or make your own colored image) and you'll be able to edit in color.
-![gfx/pokegear/johto.bin](screenshots/gfx-pokegear-johto.png)
+![Screenshot](screenshots/tilemap-studio-johto.png)
-![gfx/pokegear/kanto.bin](screenshots/gfx-pokegear-kanto.png)
+One more thing: even though town_map_pokegear.png combines the town_map.png and pokegear.png tiles, only use the first three rows for the Town Map. The rest aren't always available when you view the Town Map, unless you follow [this tutorial](Expand-the-Town-Map-tileset) to expand the tileset.
## 4. The landmarks
@@ -64,7 +63,7 @@ Landmarks are defined in [data/maps/landmarks.asm](../blob/master/data/maps/land
NewBarkTownName: db "NEW BARK¯TOWN@"
```
-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 look at the Tilemap Studio screenshot above, you'll see that the cursor is on New Bark Town, and the status bar says "Landmark (140, 100)". Also, if you print a screenshot of the Johto map (with Ctrl+P, File→Print, or the toolbar button), and look at pixel coordinates (140, 100), it's right in the middle of the New Bark Town icon:
![Screenshot](screenshots/ms-paint-johto.png)
@@ -104,38 +103,7 @@ If you're wondering why those offsets exist, it's because of how the GameBoy har
For more information on editing landmarks, see the tutorial on [how to add a new map and landmark](Add-a-new-map-and-landmark).
-## 5. GSC Town Map Editor
-
-[Step 3](#3-the-johto-and-kanto-tilemaps) described how to edit the tilemaps using a hex editor, but it can be a visual pain to do so. An alternative is the [GSC Town Map Editor](https://hax.iimarckus.org/topic/97/) program by Harrison.
-
-Usually you shouldn't use old binary hacking programs with the disassembly, but this program has an Export Map function, which creates a .map file that's (almost) exactly the same as pokecrystal's .bin files.
-
-First, [download](http://kusabax.cultnet.net/pkmn/GSC%20Town%20Map%20Editor.zip) and unzip the program. Two files it includes are GSC Town Map Editor.exe and tileset.bmp. The tileset.bmp image is used by the program to render the Town Map; it's twice the size of town_map.png and uses colors. You can use MS Paint to resize and color town_map.png and save it as tileset.bmp. The download already includes an appropriate tileset.bmp for default GSC:
-
-![tileset.bmp](screenshots/gsc-town-map-editor-tileset.bmp)
-
-Then run GSC Town Map Editor.exe, open your ROM with File→Open, and pick a region to edit. You'll see something like this:
-
-![Screenshot](screenshots/gsc-town-map-editor.png)
-
-When you're done making edits, go to File→Export Map and overwrite johto.bin or kanto.bin. (The default extension is .map, but you can enter .bin instead.) The only difference between the exported file and the original is that GSC Town Map Editor does not put $FF at the end. So edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
-
-```diff
- JohtoMap:
- INCBIN "gfx/pokegear/johto.bin"
-+ db $ff
-
- KantoMap:
- INCBIN "gfx/pokegear/kanto.bin"
-+ db $ff
-```
-
-Now your edited map will show up when you rebuild the project!
-
-Note that GSC Town Map Editor, like most old binary hacking tools, makes assumptions about the exact addresses of various content in the ROM. If you make extensive edits to the disassembly project, the addresses could change. Then you'll get an "Access violation" error when you try to pick a region. If that happens, you'll just have to use a hex editor.
-
-
-## 6. Remove the gray border for more map area
+## 5. Remove the gray border for more map area
If you're making a large region, you may want to get rid of the gray border around the map to make room for more terrain. But there's more to it than just redesigning the .bin files without any border tiles. The top three rows of tiles are covered by the Pokégear interface, the map name, and the "Where?" prompt when using Fly.