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
|
*Date created: 2020-12-01*
This tutorial is for adding a new map to the game. This is NOT a map making tutorial--this tutorial shows the exact files that need edited to add a map into the game. Therefore it is assumed that you have already created your own custom map. I'll be using the name 'TestMap1' for the tutorial, but you should swap in your own map name.
### 1. Put your .blk map file (TestMap1.blk) in the [/maps/](../blob/master/maps/) folder
### 2. Edit [/constants/map_constants.asm](../blob/master/constants/map_constants.asm)
Look for a line that says 'UNUSED'.
***You need to pay attention to which line you use, because you'll need to replace that exact same line in a few other files later.***
For this tutorial, I am replacing 'UNUSED_MAP_F4' with my custom map.
Replace that line with a line like so:
```diff
- mapconst UNUSED_MAP_F4, 0, 0 ; $F4
+ mapconst TEST_MAP_1, 6, 5 ; $F4
```
- The first part 'mapconst' is required and can't be changed
- The second part 'TEST_MAP_1' is where you put the name of your map
- NOTE: You should follow the same naming format the other maps use to avoid issues down the road
- The two numbers after the name are the height and width of the map
- This needs to match the height and width you used when creating the .blk map file
- Anything after a semi-colon at the end of a line is a comment, it's not actual code and just used for reference
### 3. Create the following file: /data/maps/headers/TestMap1.asm
```
map_header TestMap1, TEST_MAP_1, CEMETERY, 0
end_map_header
```
Change 'CEMETERY' to whatever tileset your map uses.
Keep the rest the same (use your map's name in place of TestMap1 of course).
***Remember to follow the naming scheme--if they use all caps and underscores, do the same thing.***
### 4. Create the following file: /data/maps/objects/TestMap1.asm
```
TestMap1_Object:
db $0 ; border block
def_warps
warp 4, 11, 0, REDS_HOUSE_2F
def_signs
def_objects
def_warps_to TEST_MAP_1
```
- The first line, '*db $0*' sets the block used for the outside border of the map
- The next section, 'def_warps' is for setting up warps
- The word 'warp' is required at the beginning of each warp
- The first and second numbers are coordinates of where the warp is on the map
- Use a map editor like Polished Map to find map coordinates
- The third number is a 'warp ID' that indicates which warp to go to on the following map
- Warps are counted in the order they are listed in the file, starting from 0
- So the first warp in a file has an ID of 0, the second has an ID of 1, etc.
- In my example, I'm warping from my TestMap1 to REDS_HOUSE_2F. If you open data/maps/objects/RedsHouse2F.asm and look at the list of warps, you'll only see one warp (the stairway going downstairs). This is the first (and only) warp on that map, so it's ID is 0
- The name after the warp ID is the name of the map you are warping to
- Notice the capitalization and underscores, this is required
- The next section, 'def_signs' is for setting up signs that display text
- This is not required and isn't covered in this tutorial
- The next section, 'def_objects' is for setting up objects (NPCs, trainers, etc)
- This is not required and isn't covered in this tutorial
- At the end of the file you need the 'def_warps_to' line
- I believe this sets up any maps that warp to your map, but I'm not sure
### 5. Edit [/data/maps/map_header_banks.asm](../blob/master/data/maps/map_header_banks.asm)
Remember that line I told you to remember earlier? You need to find that line in this file, and then replace it:
```diff
- db $11 ; UNUSED_MAP_F4
+ db BANK(TestMap1_h)
```
You don't have to use 'UNUSED_MAP_F4', you can replace any map including maps that already exist in the game.
### 6. Edit [/data/maps/map_header_pointers.asm](../blob/master/data/maps/map_header_pointers.asm)
Just like the last file, find the corresponding line and then replace it:
```diff
- dw SilphCo2F_h ; UNUSED_MAP_F4
+ dw TestMap1_h
```
### 7. Create the following file: /scripts/TestMap1.asm
```
TestMap1_Script:
jp EnableAutoTextBoxDrawing
TestMap1_TextPointers:
text_end ; unused
```
As far as I can tell, these two parts are required, even if you have no scripts or texts for the map
### 8. Edit [/maps.asm](../blob/master/maps,asm)
We need to include our map's files in this list somewhere. I decided to add mine after the last map in the file, which is Agataha's Room. Look for the line *AgathasRoom_Blocks: INCBIN "maps/AgathasRoom.blk"* and add the following underneath:
```diff
INCLUDE "data/maps/headers/AgathasRoom.asm"
INCLUDE "scripts/AgathasRoom.asm"
INCLUDE "data/maps/objects/AgathasRoom.asm"
AgathasRoom_Blocks: INCBIN "maps/AgathasRoom.blk"
+INCLUDE "data/maps/headers/TestMap1.asm"
+INCLUDE "scripts/TestMap1.asm"
+INCLUDE "data/maps/objects/TestMap1.asm"
+TestMap1_Blocks: INCBIN "maps/TestMap1.blk"
```
### 9. Edit [/data/maps/hide_show_data.asm](../blob/master/data/maps/hide_show_data.asm)
This step is a little complicated, and I honestly don't fully understand what this file does.
You'll need to find and replace any references to the map you've been replacing.
For example, I've been replacing 'UNUSED_MAP_F4', so I need to edit the following lines:
```diff
- dw UnusedMapF4HS
+ dw NoHS
```
Later in the file, delete the following lines:
```diff
-UnusedMapF4HS:
- db UNUSED_MAP_F4, $02, SHOW
```
That's all the required steps to add a new map. All you need to do is set up a warp to your map from another map.
At this point you'll probably want to add trainers, NPCs, text etc. There should already be some tutorials out there for those, but I may make my own tutorials later if need be.
|