Version hexen2-r6297 of the engine has just been released in https://hexenworld.org/downloads/hexen2/uhexen2-shanjaq/testing/
One of its highlight features is the possibility for mappers to now customize the in-game messages in new creative and fancy ways:
The interesting bits in the example above are the color switches and the embedded picture. But how is that possible…?
To understand that, first let’s have a look at how chars are handled with in vanilla Hexen II…
In-game messages (no matter it’s centerprint messages, plaque message, console prints, etc.) don’t use an actual font. Each character is in fact a picture of 8 x 8 pixels representing the char. All allowed characters are defined in a game asset called conchars.lmp which looks like that:
As you can see, there are basically 2 character sets: the first 256 slots (8 lines of 32 chars each) are the beige charset used mainly for console prints, and the last 256 slots are the red charset used for most of in-game messages. Each charset is virtually divided into 2 subsets of 128 chars of 4 lines each. The 4 first lines are the one used by Hexen II indeed, but the last 4 lines are totally useless: they correspond to non ASCII chars the engine is not even able to correctly read in the strings.txt file where the game strings are stored. So, say you want to use the fancy “Æ” or “Ñ” or “Ç” or whatever… Bad luck! You can still put them in strings.txt but they won’t display properly in game.
At the end of the day that’s a big waste since half of the slots cannot be used… The new feature not only allows to use them eventually, but also allows to switch the charset right in the middle of a message. But how…?
First there’s a major change in mindset: instead of considering that conchars.lmp is 2 charsets of 256 chars each, let’s consider it’s 4 charsets of 128 chars each. The good thing is: now each smaller charset can be expressed staying within the ASCII range. Each charset is numbered 1 to 4. Charset #1 and #3 are the traditional beige and red chars. Charset #2 and #4 are the previously out-of-reach ranges you can now use at will. And since they were not used previously, without doing any harm to anything already existing you can put there new fancy characters, symbols, colors and even pictures! That’s not a regular font after all, just slots of 8 x 8 pixels. You can even put several 8×8 squares side to side to draw bigger things.
That’s the case in the example above, so let’s have a closer look at how it’s built and look at the modified conchars behind the scenes:
Charset #2 now features green chars where accented letters stood in the vanilla conchars. They strategically occupy the same relative positions as in vanilla charsets #1 and #3. So the message can be written the usual way in strings.txt and it’s just a matter of switching the charset thanks to the new \x escape sequence (where x stands for 1 to 4). So the line in strings.txt looks like \2Little Bo-Peep\3 has lost her sheeps
\2 triggers charset #2 which is used to print the chars in green until \3 is encountered to switch back to the usual red charset #3 used by plaques.
In charset #4, the pictures supposed to represent the chars “A” to “H” and “a” to “h” are bits of a larger picture instead. To draw the picture, we just have to write those A-Ha-h chars in strings.txt with charset #4 active, and they will render as an art_polymorph picture. Here is the complete line in strings.txt for the fancy plaque:
The calculation of the line return is automatically computed by the game engine to fit the plaque dimensions and unfortunately resets the charset to default charset #3 at each new line. That’s why \1 must be precised both before the “shepherd’s” and “crook” words, unlike “Little Bo Peep” which is all on the same line of text. Also note it’s possible to force line returns thanks to the “@” special char to have more control (which is obviously needed for the crook picture to display properly).
Those new formatting capabilities introduced by the latest build not only concern plaques but all the following:
- Centered plaques’ messages
- Bottom plaques’ messages
- Regular centerprint messages
- Info plaques messages (objectives)
- Inter-episodes intermission texts
Other fixes/features also included in the build:
- Skyboxes now work
- variable max_fps cvar
- fix water warp shimmer
- fix translucent brush depth sorting and fog with abslight
- fix brush models in fog
- fix monster ledge detection
- fix vid_restart texture corruption
- fix player color index
- fix crash on talking doors in tibet6
- fix memory corruption with pvs
- fix multiplayer menu portrait
- fix leaf overflow in complex maps
- fix game crash while trying to display full inventory with ring items in it.
Please note, as always, that it’s a test build. So please don’t hesitate to give feedback about unexpected issues you may face in order for the team to improve the code for the next stable version.