You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>A tilemap editor for <ahref="https://github.com/pret/pokecrystal">pokecrystal</a> and <ahref="https://github.com/pret/pokered">pokered</a>.</p>
9
9
<p>Inspired by <ahref="https://hax.iimarckus.org/topic/97/">GSC Town Map Editor</a> and <ahref="https://i.imgur.com/70jDfdM.png">Karteneditor</a>, but implemented with C++ and <ahref="http://www.fltk.org/">FLTK</a>, and with support for tilemaps beyond the Town Map.</p>
10
+
<p>Source code is available at <ahref="https://github.com/Rangi42/tilemap-studio">https://github.com/Rangi42/tilemap-studio</a>.</p>
11
+
<hr>
12
+
<p>)" PROGRAM_NAME R"( displays and edits tilemap files. (There's no standard extension for those; some are .tilemap, .bin, .map, .rle, or others.) It supports all the standard ways to open a file:</p>
13
+
<ul>
14
+
<li><b>Initial:</b> Double-click a .tilemap file in File Explorer. (Run install.bat to associate .tilemap files with )" PROGRAM_NAME R"(.)</li>
15
+
<li><b>Menu bar:</b> Run )" PROGRAM_EXE R"( and select the File → Open… menu item.</li>
16
+
<li><b>Toolbar:</b> Run )" PROGRAM_EXE R"( and click the Open toolbar button.</li>
17
+
<li><b>Keyboard:</b> Run )" PROGRAM_EXE R"( and press Ctrl+O.</li>
18
+
<li><b>File Explorer:</b> Drag a .tilemap file onto )" PROGRAM_EXE R"(.</li>
19
+
<li><b>GUI:</b> Drag a .tilemap file onto the tilemap canvas of an open )" PROGRAM_NAME R"( window. You can also drag a tileset image file onto the tileset palette to load its graphics.</li>
20
+
<li><b>Command Prompt:</b> Pass the .tilemap filename (and optionally a tileset filename too) as an argument to )" PROGRAM_EXE R"(:<br><fontsize="2"><kbd>)" PROGRAM_EXE " pokecrystal" DIR_SEP "gfx" DIR_SEP "pokegear" DIR_SEP "johto.bin pokecrystal" DIR_SEP "gfx" DIR_SEP "pokegear" DIR_SEP R"(town_map.png</kbd></font></li>
21
+
</ul>
22
+
<p>Be sure to set the right format (via the Format toolbar dropdown, or the Options → Format menu) before opening a tilemap. The available formats are:</p>
23
+
<ul>
24
+
<li><b>Plain:</b> Each byte is a tile ID, top to bottom, left to right. A byte goes from $00 (0) to $FF (255), so there are 256 possible tiles.</li>
25
+
<li><b>Run-length encoded (RLE):</b> Each pair of bytes encodes a tile ID and a length to repeat that tile. For example, $F0 $0D encodes a sequence of 13 tiles with ID $F0. (A length of 0 is valid but would do nothing.)</li>
26
+
<li><b>GSC Town Map ($FF End):</b> A sequence of tile IDs ended by an $FF byte (so $FF is not a valid tile ID). Meant for the Town Map tilemaps in pokecrystal: gfx)" DIR_SEP "pokegear" DIR_SEP R"(johto.bin and kanto.bin.</li>
27
+
<li><b>Pokégear card (RLE + $FF end):</b> A sequence of tile IDs and run lengths, ended by an $FF byte (so $FF is not a valid tile ID). Meant for the Pokégear card tilemaps in pokecrystal: gfx)" DIR_SEP "pokegear" DIR_SEP R"(*.tilemap.rle.</li>
28
+
<li><b>RBY Town Map (RLE nybbles + $00 end):</b> A sequence of bytes that each encode a tile ID in their high nybble and a run length in their low nybble, ended by a $00 byte. For example, $42 encodes a sequence of two tiles with ID $04. Only 16 tile IDs can be represented, $00 to $0F. Meant for the Town Map tilemap in pokered: gfx)" DIR_SEP R"(town_map.rle.</li>
29
+
<li><b>PC Town Map (X/Y flip):</b> A sequence of bytes that each encode a tile ID in their low six bits and X/Y flip attributes in their high two bits, ended by an $FF byte. Only 64 tile IDs can be represented, $00 to $3F. Meant for the Town Map tilemaps in <ahref="https://github.com/Rangi42/polishedcrystal">Polished Crystal</a>: gfx)" DIR_SEP "town_map" DIR_SEP R"(*.bin.</li>
30
+
<li><b>SGB border (tile + attribute):</b> Each pair of bytes encodes a tile ID and an attribute byte. The only supported attribute bits are X/Y flip and four colors. Meant for the SGB borders in pokered: gfx)" DIR_SEP "red" DIR_SEP "sgbborder.map and gfx" DIR_SEP "blue" DIR_SEP R"(sgbborder.map.</li>
31
+
</ul>
32
+
<hr>
33
+
<p>Most functions are available via the menu bar, the toolbars, or shortcut keys.</p>
34
+
<p>The tilemap canvas (on the left) and tileset palette (on the right) use the mouse:</p>
35
+
<ul>
36
+
<li>Left-click a tile in the tileset palette to select it.</li>
37
+
<li>Left-click or drag in the tilemap canvas to place the selected tile.</li>
38
+
<li>Right-click to select a tile from the tilemap.</li>
39
+
<li>Middle-click and drag to scroll the tilemap.</li>
40
+
<li>Hold Shift and left-click a group of tiles to flood-fill it.</li>
41
+
<li>Hold Ctrl and left-click a tile to replace every tile of that type.</li>
42
+
</ul>
43
+
<hr>
44
+
<p>Usually a tilemap only uses one tileset image, which starts from tile $00. For these you can just use the Load Tileset function (Ctrl+L or the toolbar's blue folder button). For example, pokered's gfx)" DIR_SEP "town_map.rle uses gfx" DIR_SEP R"(town_map.png.</p>
45
+
<p>Sometimes a .png tileset has redundant tiles that get eliminated when you <kbd>make</kbd> the ROM. In those cases, just load the built .1bpp or .2bpp tileset instead. Compresses .lz files are also supported.</p>
46
+
<p>Some tilemaps may also use more than one tileset. For example, pokecrystal's gfx)" DIR_SEP "pokegear" DIR_SEP "radio.tilemap.rle uses tiles from gfx" DIR_SEP "pokegear" DIR_SEP "town_map.png, gfx" DIR_SEP "pokegear" DIR_SEP "pokegear.png, and gfx" DIR_SEP "font" DIR_SEP R"(font_extra.png. For these you can use the Add Tileset function (Ctrl+A or the toolbar's blue folder button with a green plus sign). This lets you load another tileset in addition to any you've already loaded, and can configure how it gets loaded:</p>
47
+
<ul>
48
+
<li><b>Start at ID:</b> Which tile ID to begin at, instead of $00.</li>
49
+
<li><b>Offset:</b> Skip this many tiles from the beginning of the image.</li>
50
+
<li><b>Length:</b> Load only this many tiles from the image; 0 means to load all of them.</li>
51
+
</ul>
52
+
<p>For example, pokecrystal has this code in its <code>StatsScreen_LoadFont</code> function:</p>
53
+
<pre><code> ld de, HPExpBarBorderGFX + 3 * LEN_1BPP_TILE
54
+
ld hl, vTiles2 tile $76
55
+
lb bc, BANK(HPExpBarBorderGFX), 2
56
+
call Get1bpp_2</pre></code>
57
+
<p>To copy its effect, you would add gfx)" DIR_SEP "battle" DIR_SEP R"(hp_exp_bar_border.png with the start ID $76, offset 3, and length 2.</p>
58
+
<hr>
59
+
<p>)" PROGRAM_NAME R"( is mainly for editing tilemaps using tilesets that already exist, but it can also create a tilemap and tileset from a screenshot with the Image to Tiles function (Ctrl+I or the toolbar's brown picture button). For example, if you want to display a custom full-screen picture, you might draw a 160x144-pixel (20x18-tile) mockup. You can then create a tilemap and tileset from that mockup, as long as it doesn't need too many unique tiles. (The tileset will not have duplicate tiles.)</p>
60
+
<p>This is similar to features already provided by <ahref="https://github.com/rednex/rgbds">rgbgfx</a> and <ahref="https://github.com/Optiroc/SuperFamiconv">superfamiconv</a>, but oriented toward pokered and pokecrystal projects. It has options specific for their conventions:</p>
61
+
<ul>
62
+
<li><b>Format:</b> Create the tilemap in any supported format, not just a sequence of plain tile IDs. Formats that support X/Y flip (PC Town Map or SGB border) will take advantage of that when eliminating duplicate tiles for the tileset.</li>
63
+
<li><b>Start at ID:</b> Start at a tile ID besides $00, if you plan to load the tileset somewhere else.</li>
64
+
<li><b>Use $7F for Blank Spaces:</b> Tile $7F is commonly available as the space character, so solid white tiles can be encoded as that ID.</li>
0 commit comments