Standard movement permissions:
In mapping tools like SDSME the permission data of gen. 5 games is organized in 8 matrices. A problem that everyone runs into when adding their own maps is that the height values for player and NPCs are not known. The height is calculated from the values in the first 4 layers.
The permission data is part of the map-model files in a/0/0/8.
There are 4 different types of permissions. All identified by an unique ID which is the first DWORD in the file-header:
0x34257: One permission block. Most common case
0x44347: Two permission blocks. Used for bridges or other things where the player can be on OR under
0x34452: One permission block. More than 8 layers. Not investigated yet...
0x2474E: No permission block. The collision data is extern and works in a different way. "3D collisions"
(little endian inside the files: "0x34257" = "57 42 03 00")
The permission block starts with info about its size: "20 00 20 00" -> 32x32 Tiles (cols x rows) followed by the data [1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 3...],... In spacial cases a 3rd data section is appended (more later).
Following data must be read like this (16x16 Arrays):
// 0x00__
0x__00, 0x__01, 0x__02,...
0x__10, 0x__11, 0x__12,...
...
// 0x01__
0x__00, 0x__01, 0x__02,...
0x__10, 0x__11, 0x__12,...
...
...
// 0xXX__: Layer 2 or 4
// 0x__XX: Layer 1 or 3
(B2W2) All Terrain Values: (Slope X, Slope Y) (323 Values)
(B2W2) All Height Values: (1285 Values)
Terrain:
The given slopes are the resulting height difference by walking one tile to east or south. Take in mind that inclinations greater than 1 can not be climbed by the player so they are kind of useless. At 0x0002 there is something I called pointer. This value is used everywhere where the slope has corners, for example that hillock at Route 12. This fields are enumberated in the height-layer, startet by 0, and point right behind the permission block.
Every corner produces 8 bytes:
Offset Size Description
0x00 2 Terrain 1
0x02 2 Terrain 2
0x04 2 Height 1
0x06 2 Height 2
The Terrain (1 and 2) values must be calculated to get something in the table above. Terrain table -> permission file:
Terrain 1: Offset + 1
Terrain 2: Offset / 4
The 3D characteristics of these tiles are formed by Terrain/Height 1 for the top-left and top-right corner and by Terrain/Height 2 for the bottom-left and bottom-right corner.
All other tiles are using the values from the two tables above. If the inclination is 0 to all directions, the final height is the same as specified. Else the height is perpendicular to the surface and must be calculated to get the expected result.
Important: The terrain- and height-values from B2W2 are not compatible with BW(1).