Screentext
The art of HUD text can best be accomplished using the screentext command.
screentext <tilenum> <x> <y> <zoom> <blockangle> <charangle> <quote> <shade> <pal> <orientation> <alpha> <xspace> <yline> <xbetween> <ybetween> <text flags> <x1> <y1> <x2> <y2>
It would not be fitting to document this command without also documenting its useful helper and companion, qstrdim, which calculates the dimensions taken up by an equivalent call to screentext.
qstrdim <width return var> <height return var> <tilenum> <x> <y> <zoom> <blockangle> <quote> <orientation> <xspace> <yline> <xbetween> <ybetween> <text flags> <x1> <y1> <x2> <y2>
Parameters
<width return var> and <height return var> are both gamevars to which qstrdim will assign its results
<tilenum> is the start of the font range. The most common value is STARTALPHANUM.
<x> X coordinate, normally ranged 0-320
<y> Y coordinate, normally ranged 0-200
<zoom> is normally 65536. (ex: 131072 is zoomed in 2X and 32768 is half-sized)
<blockangle> is the angle of the entire block of text, normally 0, where 360 degrees corresponds to 2048 Build units
<charangle> is the angle of each individual character, relative to the block angle, also in Build units
<quote> is the quote to print, as defined by definequote.
<shade> is 0 normally but can be any standard shade up to 31 or 63.
<pal> can be from 0-255.
<orientation> controls the way the sprite is drawn (see entry). Note: It is recommended that you always include bit 16 so that the characters will be placed correctly.
<alpha> translucence, 0-255
<xspace> the width of the space character. Can be zero or negative.
<yline> the height of an empty line. Can be zero or negative.
<xbetween> the x-distance between characters. Can be zero or negative.
<ybetween> the y-distance between lines. Can be zero or negative.
<text flags> is a bitfield describing properties of the text block (see entry)
<x1>, <y1>, <x2>, and <y2> are boundaries on the screen that define where the text may be drawn. By far the two most common set of values for these fields are:
setvarvar xdimminus xdim subvar xdimminus 1 setvarvar ydimminus ydim subvar ydimminus 1 // 0 0 xdimminus ydimminus
Notes
<x>, <y>, <xspace>, <yline>, <xbetween>, and <ybetween> are all affected by orientation flag 2048 which enables "full16" precision.
qstrdim can be helpful if you are designing complex text effects.
Text Properties Bitfield
(pretty table with explanations goes here)
This may be helpful in your CON files, using orvar to add bits and xorvar to remove them (but only when already set; ifvarand will allow you to check).
define TEXT_XRIGHT 0x00000001 define TEXT_XCENTER 0x00000002 define TEXT_YBOTTOM 0x00000004 define TEXT_YCENTER 0x00000008 define TEXT_INTERNALSPACE 0x00000010 define TEXT_TILESPACE 0x00000020 define TEXT_INTERNALLINE 0x00000040 define TEXT_TILELINE 0x00000080 define TEXT_XOFFSETZERO 0x00000100 define TEXT_XJUSTIFY 0x00000200 define TEXT_YOFFSETZERO 0x00000400 define TEXT_YJUSTIFY 0x00000800 define TEXT_LINEWRAP 0x00001000 define TEXT_UPPERCASE 0x00002000 define TEXT_INVERTCASE 0x00004000 define TEXT_IGNOREESCAPE 0x00008000 define TEXT_LITERALESCAPE 0x00010000 define TEXT_BACKWARDS 0x00020000 define TEXT_GAMETEXTNUMHACK 0x00040000 define TEXT_DIGITALNUMBER 0x00080000 define TEXT_BIGALPHANUM 0x00100000 define TEXT_GRAYFONT 0x00200000
Default settings replicating other text commands
gametext
- <tilenum>: STARTALPHANUM
- <x>: divided in half
- <xspace>: 5
- <yline>: 8
- <xbetween>: 0
- <ybetween>: 0
- <text flags>: TEXT_GAMETEXTNUMHACK
minitext
- <tilenum>: MINIFONT
- <xspace>: 4
- <yline>: 8
- <xbetween>: 1
- <ybetween>: 0
- <text flags>: TEXT_UPPERCASE (unless your mod adds lowercase tiles to the MINIFONT set, in which case 0)
- <tilenum>: BIGALPHANUM
- <y>: decremented by 12
- <xspace>: 5
- <yline>: 16
- <xbetween>: 0
- <ybetween>: 0
- <text flags>: TEXT_BIGALPHANUM + TEXT_UPPERCASE (+ TEXT_LITERALESCAPE if you want)