The BEX format
This is just an overview of the main bex features. Full details can be found in the file boomdeh.txt, which is included with the boom source port, or can be found here. Please note, this file is intended for distribution with BOOM, and is an important part of editing with that source port. The team TNT page (authors of BOOM) can be found here.
Bex (Boom extensions to dehacked) dramatically increased the flexibility of dehacked when they were introduced with team TNTs source port Boom. They removed a great many of the limitations of dehacked, and made editing other areas easier. Other source ports, eg Zdoom also support bex, and have even added to the format.
Dehacked does not support bex. If you load a dehacked patch that has had bex features added to it, dehacked will report errors, may crash, and will loose any bex information in the file when saving. Because of this, I find it easier to do as much with dehacked as I think I will be able to, and then finish things off, adding my bex sections using a text editor.
You can, however, keep the bex and deh files separate, but load them both using the bex include statement in a bex file to include another deh or bex file.
INCLUDE NOTEXT myfile.deh
The NOTEXT tells boom to skip any text replacements in the included deh file. Text replacements can be handled differently in bex.
In order to distinguish the two types of file, team TNT introduced the convention of using the .bex extension for bex files. Dehacked files normally have a .deh extension, and the .bex extension identifies a file with bex sections.
So what does bex do?
When you change the bits of a thing, a deh file has a cryptic number in it that tells doom the bits for the thing. Bex introduced friendly mnemonics to help make changing a things bits make more sense.
Eg (from TNTs boomdeh.txt)
Normal deh format
Bits = 205636102
More friendly bex format
Bits = SOLID+SHOOTABLE+NOBLOOD
A full list of the mnemonics can be found in boomdeh.txt.
Here is where bex really makes a difference. With dehacked, you can only change the code pointer of a frame that already has a code pointer, and you cannot remove a code pointer from a frame. Bex allows you to give a code pointer to any frame, whether it originally had one or not. It also has a null pointer to set a frame that originally had a pointer to not have one.
To use the bex codepointers, you need to add a [CODEPTR] section to your bex file.
FRAME 13 = FireShotgun
FRAME 108 = Look
FRAME 109 = Chase
FRAME 139 = null
A full list of both deh and bex codepointers can be found here and in boomdeh.txt.
You can add/modify the par times of levels to more accurately reflect a suitable par for your level. If you are using zdoom, this has been superseded by the information for levels you can add in a special data lump called MAPINFO.
par e m p << for DOOM 1: episode, map, parseconds
par m p << for DOOM 2: mapnumber, parseconds
Dehacked changed text strings by simply searching for and replacing text within the compiled doom.exe. This could lead to problems, and also limited you to the length of string you could use for your replacement. The bex format has a series of strings with predefined names or mnemonics. If you wish to change any of these, add them to a strings section in your bex file.
GOTBLUESKUL = You found a blue head.
A full list of the possible mnemonics, and their original texts can be found in boomdeh.txt