Skip to content

Expand the Town Map tileset Alternate

Colton G. Rushton edited this page Jun 22, 2022 · 11 revisions

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.

The main tutorial is less involved, however doesn't allow for the Pokégear and Town Map separation like in this tutorial.

Contents

  1. Move text out of the way
  2. Replace tile IDs
  3. Add two rows of palettes
  4. Fix the Pokégear tilemaps
  5. Fix the Pokédex
  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 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:

 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
 InitPokegearTilemap:
 	xor a
 	ldh [hBGMapMode], a
 	hlcoord 0, 0
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
-	ld a, $4f
+	ld a, $6f
 .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
 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
 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
 _FlyMap:
 ...
	ld de, FlyMapLabelBorderGFX
-	ld hl, vTiles2 tile $30
+	ld hl, vTiles2 tile $50
	lb bc, BANK(FlyMapLabelBorderGFX), 6
	call Request1bpp
 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
 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
 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:

 ; 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 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:

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:

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 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.

gfx/pokegear/town_map.png

5. Fix the Pokédex

Edit engine/pokedex/pokedex.asm:

 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 and gfx/pokegear/kanto.bin following the Edit the Town Map tutorial.

Clone this wiki locally