Jump to content

Recommended Posts

Posted
Map Files  
- located at /a/0/6/5
- contains 5 sections
#1 Section - Header
- section is 20 bytes
Offset Length Name Description
0x0 0x4 Movement Permission Size The size of the Movement Permissions in Section #3. Always 0x800.
0x4 0x4 3D Object Size The size of the 3D Objects defined in Section #4.
0x8 0x4 NSBMD Model Size The size of the embedded Model (NSBMD) file in Section #5.
0xC 0x4 BDHC Size The size of the embedded Terrain (BDHC) file in Section #6.
0x10 0x4 Unknown Section Size The size of the section of unknown data in Section #2.
#2 Section - Unknown Data
- data in this section serves a currently unknown function
- data is unique to HG/SS and theorized to be Pokemon size permissions
Offset Length Name Description
0x0     .
#3 Section - Movement Permissions
- data is always 2048 bytes, two bytes for each tile, and all maps are 32x32 tiles
- tile data is ordered from left to right, bottom to top
Offset Length Name Description
0x0 0x1 Special Permission Allows for special permissions. A rather incomplete list can be found in the Appendix.
0x1 0x1 Movement Permission Three valid values: 0x0 No Restriction, 0x4 No Special Permissions (Ignore First Byte), 0x8 Solid/No Movement
#4 Section - 3D Objects
- section is 48 bytes per object defined
- 3D Objects Size in Section #1 will be the total size of this section in bytes
Offset Length Name Description
0x0 0x4 Object ID Number A complete list of Object ID numbers can be found in the Appendix.
0x4 0x2 Y Fractional Variable allowing fractional Y-axis positioning. (Defaults to 00 00.)
0x6 0x2 Y Coordinate Position of the object on the Y-axis.
0x8 0x2 Z Fractional Variable allowing fractional Z-axis positioning. (Defaults to 00 00.)
0xA 0x2 Z Coordinate Position of the object on the Z-axis.
0xC 0x2 X Fractional Variable allowing fractional X-axis positioning. (Defaults to 00 00.)
0xE 0x2 X Coordinate Position of the object on the X-axis.
0x10 0xC ???? This section serves a currently unknown function.
0x1D 0x4 Width The size of the object on the Y-axis.
0x21 0x4 Height The size of the object on the Z-axis.
0x25 0x4 Length The size of the object on X-axis.
0x29 0x7 ???? This section serves a currently unknown function.
#5 Section - NSBMD Model
- NSBMD Model Size in Section #1 will be the total size of this section in bytes
- this is the 3D model of the map itself
- NSBMD model specifications aren't listed here.
#6 Section - Terrain (BDHC)
- BDHC Size in Section #1 will be the total size of this section in bytes
- BDHC file specifications are detailed here.

 

Terrain Files (BDHC)  
Credit and thanks goes to Mikelan98 for finally cracking these files.
This section will have a ton of notes, as the format is very complex. Refer to Mikelan98's guide for help.

- located at the end of map files, found at /a/0/6/
- contains 7 sections
#1 Section - Header Data
Offset Length Name Description
0x0 0x4 Magic ID #BDHC (0x42444843)
0x4 0x2 Points Size The number of points defined in Section #2.
0x6 0x2 Inclines Size The number of inclines defined in Section #3.
0x8 0x2 Heights Size The number of heigths defined in Section #4.
0xA 0x2 Plates Size The number of plates defined in Section #5.
0xC 0x2 Strips Size The number of strips defined in Section #6.
0xE 0x2 Access Lists Size The number of access lists defined in Section #7.
#2 Section - Points 
- section length will be 8 bytes multiplied by Points Size from Section #1 
- each 8 bytes follows the format below
Offset Length Name Description
0x0 0x4 Padding Color
0x4 0x4 X Coordinate X Coordinate for first point. (Little Endian)
0x8 0x4 Padding  
0xC 0x4 Y Coordinate Y Coordinate for first point. (Little Endian)
Notes: 
- These coordinates define points on the map. 
- Maps are always 32x32 tiles. 
- Coordinates are defined from the center of the map. 
- The coordinates for the center four tiles are:
- Northwest: 00 00 FF FF, 00 00 FF FF
- Northeast: 00 00 00 00, 00 00 FF FF
- Southwest: 00 00 FF FF, 00 00 00 00
- Southeast: 00 00 00 00, 00 00 00 00
- Coordinates south and east will increase. Coordinates north and west will decrease. 
- The coordinates of the outside corners are:
- Northwest: 00 00 F0 FF, 00 00 F0 FF
- Northeast: 00 00 10 00, 00 00 F0 FF
- Southwest: 00 00 F0 FF, 00 00 10 00
- Southeast: 00 00 10 00, 00 00 10 00
#3 Section - Inclines 
- section length will be 12 bytes multiplied by Inclines Size from Section #1 
- each 12 bytes specifies a type of incline
Offset Length Name Description
0x0 0x12 Incline Type Specifies a type of incline.
Notes: 
- It is assumed that the 12 bytes define coordinates in some way. 
- Because it is not fully understood, here is a list of known inclines:
- Flat Plate: 00 00 00 00 00 10 00 00 00 00 00 00
- North Stairs: 00 00 00 00 50 0B 00 00 50 0B 00 00
- East Stairs: B0 F4 FF FF 50 0B 00 00 00 00 00 00
- West Stairs: 50 0B 00 00 50 0B 00 00 00 00 00 00
#4 Section - Heights 
- section length will be 4 bytes multiplied by Inclines Size from Section #1 
- each 4 bytes specifies a height
Offset Length Name Description
0x0 0x2 Fractional Z Coordinate Variable allowing fractional Z-axis positioning. Defaults to 00 00 (Little Endian)
0x2 0x2 Z Coordinate Vertical positioning coordinate. Defaults to 00 00. (Little Endian)
Notes: 
- Up on the Z-axis subtracts, while down on the Z-axis adds. 
- Fractional coordinates are divided by -65536, e.g., 00 80 = 32768/-65536, or -0.5. 
- Add both variables for final height, e.g., 00 80 FF FF = -0.5 + 1 = +0.5
Formulas: 
In the Spanish version of the tutorial Mikelan98 wrote, he posted some formulas for determining the heights you need to define in this section when dealing with specific types of slopes. They also allow one to figure out how to make formulas for other types of slopes. Here, I'll translate them.
- Northward Stairs: Height = 0xB505 * (-(y)-(h))
- Westward Stairs: Height = 0xB505 * (x-h)
- Eastward Stairs: Height = 0xB505 * (x-h+1)
- Where:
- x = the position of the stairs on the X-axis, unless the tile is more than one tile long, in which case you would use the tile that is lower on the Z-axis
- y = the position of the stairs on the Y-axis
- h = the height of the bottom of the stairs + 1
#5 Section - Plates 
- section length will be 8 bytes multiplied by Plates Size from Section #1 
- each 8 bytes section builds a plate using definitions from the previous three sections
Offset Length Name Description
0x0 0x1 First Point Index The index of the Point used for the northwesternmost corner of the plate.
0x1 0x1 Padding Color
0x2 0x1 Second Point Index The index of the Point used for the southeasternmost corner of the plate.
0x3 0x1 Padding  
0x4 0x1 Incline Index The index of the Incline used for this plate..
0x5 0x1 Padding  
0x6 0x1 Height Index The index of the Height used for this plate.
0x7 0x1 Padding  
Notes: 
- The indexes for these are simply the order in which each previous section was defined. 
- For Points, if you're using the first two Points to construct a plate, you would use 00 & 01. 
- This creates a rectangular plate between the coordinates defined, with the defined inclination and height.
#6 Section - Strips 
- section length will be 8 bytes multiplied by Strips Size from Section #1 
- each 8 bytes section builds a plate using definitions from the previous three sections
Offset Length Name Description
0x0 0x2 Padding Color
0x2 0x2 Lower Bound The southernmost tile of the strip. (Little Endian)
0x4 0x2 List Elements The number of list elements from Section #7 to use. (Little Endian)
0x6 0x2 List Start The index of the first list element from Section #7 to use. (Little Endian)
Notes: 
- The first Strip begins at the northenrmost horizontal "strip" and ends at the first defined Lower bound. 
- The second Strip begins at the next tile south of the first Lower Bound and ends at the second defined Lower Bound. 
- The List Start index works the same as the indexes in Section #5. 
- List Elements counts elements including List Start. 
- More information is noted after Section #7 - Access List.
#7 Section - Access List 
- section length will be 2 bytes multiplied by Strips Size from Section #1 
- each 2 bytes is a list entry
Offset Length Name Description
0x0 0x2 Plate Index The index number of a plate from Section #4.
Notes: 
- The Plate index number references Plates in the order they're defined, the same as in previous sections. 
- The Plates in this list are referenced in the section above, and they're accessed, once again, by index number. 
- The Plates are ordered in groups, and individual plates generally appear multiple times. 
- The Plates in this section that are referenced in the previous section, are plates that can be accessed from that strip. 
- More information and visuals can be found in Mikelan98's guide.
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...