1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
**Note:** You should *not* follow this tutorial and the main one! Pick one.
This is an alternative tutorial on how to expand the Town Map's tileset. It has more changes but allows you to keep the Pokégear and Town Map images separate and keeps the Pokégear tiles from being loaded when they don't need to be. This tutorial supports only adding another 32 tiles. If you need any more, follow the main tutorial.
## Contents
1. [Move text out of the way](#1-move-text-out-of-the-way)
2. [Replace tile IDs](#2-replace-tile-ids)
3. [Add two rows of palettes](#3-add-two-rows-of-palettes)
4. [Fix the Pokégear tilemaps](#4-fix-the-pokégear-tilemaps)
5. [Fix the Pokédex](#5-fix-the-pokédex)
6. [Create your own Town Map](#6-create-your-own-town-map)
## 1. Move text out of the way
Follow steps 1-5, 9 and 10 of [Expand tilesets from 192 to 255 tiles](Expand-tilesets-from-192-to-255-tiles) to move usable text from the bottom left part of VRAM. Skip if you've already done it.
## 2. Replace tile IDs
Edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):
```diff
Pokegear_LoadGFX:
call ClearVBank1
ld hl, TownMapGFX
ld de, vTiles2
ld a, BANK(TownMapGFX)
call FarDecompress
ld hl, PokegearGFX
- ld de, vTiles2 tile $30
+ ld de, vTiles2 tile $50
ld a, BANK(PokegearGFX)
call FarDecompress
```
```diff
InitPokegearTilemap:
xor a
ldh [hBGMapMode], a
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, $4f
+ ld a, $6f
```
```diff
.PlacePhoneBars:
hlcoord 17, 1
- ld a, $3c
+ ld a, $5c
ld [hli], a
inc a
ld [hl], a
hlcoord 17, 2
inc a
ld [hli], a
call GetMapPhoneService
and a
ret nz
hlcoord 18, 2
- ld [hl], $3f
+ ld [hl], $5f
ret
```
```diff
Pokegear_FinishTilemap:
hlcoord 0, 0
ld bc, $8
- ld a, $4f
+ ld a, $6f
call ByteFill
hlcoord 0, 1
ld bc, $8
- ld a, $4f
+ ld a, $6f
call ByteFill
ld de, wPokegearFlags
ld a, [de]
...
call nz, .PlaceRadioIcon
hlcoord 0, 0
- ld a, $46
+ ld a, $66
call .PlacePokegearCardIcon
ret
.PlaceMapIcon:
hlcoord 2, 0
- ld a, $40
+ ld a, $60
jr .PlacePokegearCardIcon
.PlacePhoneIcon:
hlcoord 4, 0
- ld a, $44
+ ld a, $64
jr .PlacePokegearCardIcon
.PlaceRadioIcon:
hlcoord 6, 0
- ld a, $42
+ ld a, $62
```
```diff
PokegearMap_UpdateLandmarkName:
push af
hlcoord 8, 0
lb bc, 2, 12
call ClearBox
pop af
ld e, a
push de
farcall GetLandmarkName
pop de
farcall TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
- ld [hl], $34
+ ld [hl], $54
ret
```
```diff
_FlyMap:
...
ld de, FlyMapLabelBorderGFX
- ld hl, vTiles2 tile $30
+ ld hl, vTiles2 tile $50
lb bc, BANK(FlyMapLabelBorderGFX), 6
call Request1bpp
```
```diff
TownMapBubble:
; Draw the bubble containing the location text in the town map HUD
; Top-left corner
hlcoord 1, 0
- ld a, $30
+ ld a, $50
ld [hli], a
...
; Top-right corner
- ld a, $31
+ ld a, $51
ld [hl], a
hlcoord 1, 1
...
; Bottom-left corner
hlcoord 1, 2
- ld a, $32
+ ld a, $52
ld [hli], a
...
; Bottom-right corner
- ld a, $33
+ ld a, $53
ld [hl], a
...
; Up/down arrows
hlcoord 18, 1
- ld [hl], $34
+ ld [hl], $54
ret
```
```diff
TownMapPals:
; Assign palettes based on tile ids
hlcoord 0, 0
decoord 0, 0, wAttrmap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
.loop
; Current tile
ld a, [hli]
push hl
-; The palette map covers tiles $00 to $5f; $60 and above use palette 0
+; The palette map covers tiles $00 to $7e, $7f and above aren't available
- cp $60
+ cp $7f
jr nc, .pal0
```
```diff
LoadTownMapGFX:
ld hl, TownMapGFX
ld de, vTiles2
- lb bc, BANK(TownMapGFX), $30
+ lb bc, BANK(TownMapGFX), $50
call DecompressRequest2bpp
ret
```
## 3. Add two rows of palettes
Edit [gfx/pokegear/town_map_palette_map.asm](../blob/master/gfx/pokegear/town_map_palette_map.asm):
```diff
; gfx/pokegear/town_map.png
townmappals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
townmappals EARTH, EARTH, CITY, EARTH, POI, POI_MTN, POI, POI_MTN
townmappals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
townmappals EARTH, EARTH, BORDER, EARTH, EARTH, BORDER, BORDER, BORDER
townmappals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
+ townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
+ townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
+ townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
+ townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
; gfx/pokegear/pokegear.png
townmappals BORDER, BORDER, BORDER, BORDER, POI, POI, POI, BORDER
townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
townmappals CITY, CITY, CITY, CITY, CITY, CITY, CITY, CITY
townmappals CITY, CITY, CITY, CITY, CITY, CITY, CITY, BORDER
townmappals CITY, CITY, CITY, CITY, CITY, CITY, CITY, CITY
townmappals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
```
## 4. Fix the Pokégear tilemaps
This requires a hex editor of your choice.
Edit [gfx/pokegear/clock.tilemap.rle](../blob/master/gfx/pokegear/clock.tilemap.rle) and replace its contents with:
```
6F 08 6F 04 50 01 7F 06 51 01 6F 08 6F 04 7F 08 6F 0C 52 01
7F 06 53 01 6F 14 6F 02 06 01 07 0E 17 01 6F 02 6F 02 16 01
7F 0E 16 01 6F 02 6F 02 16 01 7F 0E 16 01 6F 02 6F 02 16 01
7F 0E 16 01 6F 02 6F 02 16 01 7F 0E 16 01 6F 02 6F 02 16 01
7F 0E 16 01 6F 02 6F 02 26 01 07 0E 27 01 6F 02 6F 14 FF
```
Then edit [gfx/pokegear/radio.tilemap.rle](../blob/master/gfx/pokegear/radio.tilemap.rle):
```
6F 08 06 01 07 0A 17 01 6F 08 16 01 6F 02 57 01 6F 01 58 01
59 01 6F 01 5A 01 6F 02 16 01 68 01 6A 07 16 01 5B 0A 16 01
6C 01 6E 07 16 01 6F 0A 16 01 6C 01 6E 07 16 01 56 01 7F 01
78 01 79 01 7A 01 7B 01 7C 01 7D 01 7F 01 55 01 16 01 6C 01
6E 07 26 01 07 0A 27 01 6C 01 6E 12 6D 01 6C 01 6E 12 6D 01
6C 01 7F 12 6D 01 6C 01 7F 12 6D 01 6C 01 7F 12 6D 01 6C 01
6E 12 6D 01 FF
```
And edit [gfx/pokegear/phone.tilemap.rle](../blob/master/gfx/pokegear/phone.tilemap.rle):
```
6F 08 06 01 07 0A 17 01 6F 08 16 01 6F 0A 16 01 06 01 07 07
27 01 6F 0A 16 01 16 01 7F 12 16 01 16 01 7F 12 16 01 16 01
7F 12 16 01 16 01 7F 12 16 01 16 01 7F 12 16 01 16 01 7F 12
16 01 16 01 7F 12 16 01 16 01 7F 12 16 01 16 01 7F 12 16 01
FF
```
Replace [gfx/pokegear/town_map.png](../blob/master/gfx/pokegear/town_map.png) with the file below, or a new image with new tiles. Keep it 128x40 with border tiles in the same place as the ones below.

## 5. Fix the Pokédex
Edit [engine/pokedex/pokedex.asm](../blob/master/engine/pokedex/pokedex.asm):
```diff
DexEntryScreen_MenuActionJumptable:
...
.Area:
...
predef Pokedex_GetArea
call Pokedex_BlackOutBG
+ call Pokedex_LoadGFX
+ call Pokedex_LoadAnyFootprint
```
That will fix the tiles not being right when exiting the map.
## 6. Create your own Town Map
Then, edit [gfx/pokegear/johto.bin](../blob/master/gfx/pokegear/johto.bin) and [gfx/pokegear/kanto.bin](../blob/master/gfx/pokegear/kanto.bin) following the [Edit the Town Map](Edit-the-Town-Map) tutorial.
|