Jump to content

Recommended Posts

It's been a loooong time, but finally, I've discovered how the BDHC files work. Please, if you are gonna copy this post in other site, give credits! First of all, I have to thank JayT, who discovered how is the file structured in different parts.

Header,

Of course, we have BDHC as the "magic word".

Then after that will come six Int16 numbers which describe how many ELEMENTS are in each of the follwing six sections. I will call these six numbers P,Q,R,S,T,U.

Data,

The length of each section is then determined like so...

1) - P * 8

2) - Q * 12

3) - R * 4

4) - S * 8

5) - T * 8

6) - U * 2

Now, I'm gonna explain what does each part.

Part P

Sets the coordinates of certain points, used later to build rectangles or "plates" of different heights in the Part S. The structure of each element is the following one:

00 00 XX XX 00 00 YY YY

XX XX are the coordinates in the X-axis, and YY YY the Y-axis ones. Keep in mind that the origin of coordinates is located at the midpoint of the map, not in a corner. This means that the lower right corner always use positive numbers, but the upper left corner instead must use negative numbers.

Remember that FF FF = -1, FE FF = -2, FD FF = -3...

The four tiles in the midpoint of the map are (FFFF, FFFF), (0000, FFFF), (FFFF, 0000) and (0000, 0000) respectively.

Thus, the point of the upper left corner is:

00 00 F0 FF 00 00 F0 FF

And the lower right corner:

00 00 10 00 00 00 10 00

Part Q

It may be related to the stairs, but I need to investigate further. I've already solved this part, but I've still got to translate it to English :P

Part R

It sets the different heights where the hero can be in different rectangles or "plates". The structure of the elements of this part is:

MM MM ZZ ZZ

ZZ ZZ refers to the complete-tiles height, ie; for example if the character is at a neutral level, then ZZ ZZ = 00 00. If we climb some stairs and now we are in a height +1, then ZZ ZZ = FF FF (at higher height, instead of growing, it decreases) . If we were at a height +5, it would be FB FF. And if for example we were at -2; 02 00.

MM MM measures, instead of full tiles, 65536-ths of tile. For not to talk complicated things; MM MM = 00 80 if the character is in a lake (it would be half a tile down, ie -0.5 tall) and MM MM = 00 00 if the character is anywhere else.

For example, if we have:

00 80 FF FF

it would mean:

FF FF = Height +1

00 80 = Height -0.5

Total height = +0.5

Part S

Link points of Part P to create the "plates" or rectangles, and assigns a height of an element of Part R.

AA 00 BB 00 QQ 00 RR 00

AA is the number (in hex) of the Part P element where the point of the rectangle in the upper left corner is. Remember that the first element is 00, the second is 01, the third is 02...

BB is the number (in hex) of the Part P element where the point of the rectangle in the lower right corner is.

RR is the number (in hex) of the Part R element which establishes the height of the plate.

If in Part P, for example, we have this:

00 00 F0 FF 00 00 F0 FF

00 00 10 00 00 00 10 00

And in the Part R we have:

00 00 FE 00

00 00 01 00

In the S part we have to write:

00 00 01 00 00 00 00 00

so we create a plate covering from (-16, -16) to (16, 16) (ie, the whole map) and setting a height in the Z axis +2. If instead out:

00 00 01 00 00 00 01 00

It would be the same as the previous one, but with a height of -1.

Part T

It divides the map in horizontal strips. Everything must be divided so if we move vertically (up or down) and thus we get in/out of a lake, stairs or similar, we must also be entering a new strip. It's hard to explain; the game can not detect when you enter an area with different height when you move vertically in the same strip (horizontally no problem) so you have to create a new separate strip. As I know it's hard to understand, here's a little picture:

hWhX6qR.png

There is an element for each strip there. The structure of each element of Part T is:

00 00 YY YY NN NN UU UU

Where YY YY is the Y-axis line where the lower limit of the strip is. NN is the number of elements of the Part U that are taken, and starting counting from element number UU UU. Do not worry, I'll explain later.

For example, a map where there were two strips, one in the upper half and one in the lower half, would be:

00 00 00 00 NN NN UU UU

00 00 10 00 NN NN UU UU

Part U

It is a list or enumeration of adjacent plates/rectangles to the strip with which it is linked in Part T. That is, if I'm in the strip 00, Part T load a number of elements of the Part U where there are numbered all the plates where the player is or can access, from this strip.

The structure of the elements of Part U is:

SS 00

where SS is the number (in hex) of the Part S plate. Part U have many elements of these, and they are usually "segmented" in "zones". In Part T is loaded the number of items to be taken (NN NN) and the number it starts counting (UU UU).

For example, in Part U we have:

00 00

01 00

02 00

04 00

00 00

03 00

04 00

And in the T part we are:

00 00 YY YY 04 00 00 00

00 00 YY YY 03 00 04 00

Then, from the first strip, we are or we can access the plates 00, 01, 02 and 04, while from the second strip we are or we can access the plates 00, 03 and 04. Remember they are all adjacent plates, ie, plates belonging to the strip and the ones which are in the limits but do not belong to it (ie, those plates whose height the game has to load while the player is in the strip).

Share this post


Link to post
Share on other sites

This is really interesting. I haven't looked at this in a while, but BDHC has always been bothering me because of how erratic changes would cause.

Which part is the effect of stepping? It has data that says that the Hero splashes (ie puddle) or makes sand footprints, and then has the appropriate sound associated with it.

Share this post


Link to post
Share on other sites
This is really interesting. I haven't looked at this in a while, but BDHC has always been bothering me because of how erratic changes would cause.

Which part is the effect of stepping? It has data that says that the Hero splashes (ie puddle) or makes sand footprints, and then has the appropriate sound associated with it.

Nope, those effects are in the Permission Editor in the SDSME :P

BDHCs only affect to the height where the hero is at.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...