Knowledge Base - Message Specials

Message Specials


The message functions have been enhanced in ZDoom and offer a lot of new functionality. To use these specials you must have the latest version of ACC.EXE.

  • hudmessage (text; int type, int id, int color, fixed x, fixed y, fixed holdTime, ...);
  • hudmessagebold (text; int type, int id, int color, fixed x, fixed y, fixed holdTime, ...);

Hudmessage and hudmessagebold both work like print and printbold, except they offer more flexibility. Text is a normal print specification, as used with print(bold). A semicolon separates it from the rest of the function's parameters, because a print specification can build a big string from littler comma-separated parts. Type is the type of message to create; currently, there are 3. ID is an identifier for the message. If id is non-zero, then if a message with that id is already on screen, it will be removed before displaying this message. Color is the color of the message text.

X and y specify the location of the message on the screen. Values for x are in the ranges:

  • [0.0, 1.0]: Position between left and right edge valid box locations
  • [-1.0, 0.0): Position between left and right edge of screen
  • (1.0, 2.0]: Same as [0.0,1.0], but center each line inside box
  • [-2.0, 1.0): Same as [-1.0,0.0), but center each line inside box

Valid values for y are:

  • [ 0.0, 1.0]: Position between top and bottom of valid box locations
  • [-1.0, 0.0): Position between top and bottom edge of screen

You can think of each message being inside a box. The difference between positive and negative values for these parameters is that positive values position the box the message is in on the screen, and negative values position the left/top edge of the box the message is in.

Here are some examples that will hopefully help. (0.5,0.0) positions the message box in the middle of the screen at the top edge.

(0.0,0.5) positions it in the middle along the left edge of the screen.

(-0.25,0.0) positions the left edge of the message box 1/4 of the way in from the left side of the screen at the top.

(1.5,0.5) centers the box on the screen, and also centers each line inside the box.

HoldTime is how long the message stays on screen, in seconds.

Note that x, y, and holdtime are all fixed point values, not ints. If you use a decimal point, acc will automatically convert the number to fixed point for you. (Meaning that if you use a value such as 1.0, acc will treat it as if you had used 65536.) You can use FixedDiv and FixedMul to divide and multiply fixed point numbers, just like with the source code.

Messages types other than 0 also take additional parameters.

For type 1:
..., fixed fadetime);

Fadetime is the time, in seconds, that the message takes to fade out after its holdtime is up.

For type 2:
..., fixed typetime, fixed fadetime);

Typetime is the time, in seconds, that it takes each character of the message to appear on the screen. After every character has been "typed," the message waits for holdtime seconds and then fades out for fadetime seconds.

If you want to use these two internal functions, here are some useful #defines:

#define CR_UNTRANSLATED -1
#define CR_BRICK  0
#define CR_TAN    1
#define CR_GRAY   2
#define CR_GREY   2
#define CR_GREEN  3
#define CR_BROWN  4
#define CR_GOLD   5
#define CR_RED    6
#define CR_BLUE   7
#define CR_ORANGE 8
#define CR_WHITE  9
#define CR_YELLOW 10

#define HUDMSG_PLAIN          0
#define HUDMSG_FADEOUT        1
#define HUDMSG_TYPEONFADEOUT  2
#define HUDMSG_FADEINOUT      3

Sources

ZDoom reference by Marisa Heit.

Back