The Heads Up Display (or HUD) is configured by using an INI file that is specified in the PlayerSetup entity as the HUDInfoFile entry. The default Reality Factory HUDInfoFile is called hud.ini, although you can change this to any file you wish. The HUDInfoFile is laid out similar to a standard Windows INI file with sections containing information about each element of the Hud. This INI file is a text file and can be edited by any text editor, such as NotePad.
Each section in the HUDInfoFile starts with a name enclosed in square brackets,
such as [compass]
or [mana]
. All lines after this, up to the
start of the next section define information about that Hud element. This
information varies depending on the type of element being defined.
There are three built-in Hud elements in Reality Factory, a compass, radar and the player position.
The compass requires its section to start with [compass]
.
The default compass section looks like this:
[compass]
frame = hud\hud_compassfrm.bmp
framealpha = hud\a_hud_compassfrm.bmp
indicator = hud\hud_compass.bmp
indicatoralpha = hud\a_hud_compass.bmp
framex = -138
framey = 138
indicatoroffsetx = 46
indicatoroffsety = 7
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
compass. If these lines are missing then no frame will be shown. The lines
indicator
and indicatoralpha
define the bitmap
and alpha map used as the compass indicator. If these lines are missing then no
indicator is shown. The compass indicator must be a specific size and layout
and, if you wish to change the look, must follow the size and layout of compass.bmp.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at
the center of the screen width. If framey is equal to center
then
the center of the identifier bitmap is placed at the center of the screen height.
The lines indicatoroffsetx
and indicatoroffsety
define the x and y offset of the indicator from (framex, framey). This defines
the screen location of the indicator bitmap's upper left corner, relative to
the frame's location.
The radar requires its section to start with [radar]
.
The default radar section looks like this:
[radar]
frame = hud\hud_radar.bmp
framealpha = hud\a_hud_radar.bmp
indicator = hud\indicator_green.bmp
indicatoralpha = hud\a_indicator.bmp
npcindicator = hud\indicator_red.bmp
npcindicatoralpha = hud\a_indicator.bmp
framex = -138
framey = 10
range = 3000
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
radar. If these lines are missing then no frame will be shown. The lines
indicator
and indicatoralpha
define the bitmap
and alpha map used as the radar indicator for all non-npc actors. The lines
npcindicator
and npcindicatoralpha
define the
bitmap and alpha map used as the radar indicator for all npc actors.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at
the center of the screen width. If framey is equal to center then the center
of the identifier bitmap is placed at the center of the screen height.
The line range
defines the number of texels away from the
player that the radar will operate.
The player position element requires its section to start with [position]
.
Instead of using an indicator bitmap, the position element displays numeric text
to show the (x,y,z) location of the player. A sample section would look like:
[position]
frame = position.bmp
framealpha = a_position.bmp
framex = -150
framey = 0
indicatoroffsetx = 15
indicatoroffsety = 5
font = Tahoma
width = 4
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
position element. If these lines are missing then no frame will be shown.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at
the center of the screen width. If framey is equal to center
then the center of the identifier bitmap is placed at the center of the screen
height.
The lines indicatoroffsetx
and indicatoroffsety
define the x and y offset of the text from (framex, framey). This defines the
screen location of the indicator text's upper left corner, relative to the
frame's location.
The line font
defines the font used to display the numeric text.
See Font XML Files for information on how to define a font.
The line width
defines the number of characters shown for each
of the x,y and z values. The default is 4. Each value is displayed with 1
space between it and the next value.
Pictures can be displayed with the low level Pawn command ShowHudPicture. To make use of this feature the pictures must be defined in the following way:
[picture#]
bitmap =
bitmapalpha =
active =
or
[picture#]
giffile =
active =
where # is the ID of the picture. Examples:
[picture0]
bitmap = hud\black.bmp
bitmapalpha = hud\white.bmp
active = false
[picture1]
giffile = menu\animcursor.gif
active = false
In conjunction with weapon reloading it is possible to make the HUD display the amounts left in the clip and the number of clips left, rather than just the amount of ammunition. This change only applies if the currently selected weapon supports clips. If it doesn't, then just the amount of ammunition will be shown.
To make the HUD entry show the amount left in the clip add the line:
style = magazine
to the HUD definition. To make it show the number of clips left add this line:
style = clip
To show both clips and magazine contents at the same time you must use the
~
extension to the HUD entry name and define two different
entries. For example, to show magazines and clips for bullets you would make
the definitions like this:
[bullet]
type = numeric
style = magazine
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 138
font = Tahoma
width = 3
active = false
[~bullet]
type = numeric
style = clip
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 158
font = Tahoma
width = 3
active = false
To display an attribute as a Hud element place its name inside square brackets
to start a section. In order to allow the display of an attribute in two
different ways [name]
and [~name]
both refer to
the same attribute. There are 3 different types of attribute display that can
be used, verticle
, horizontal
and
numeric
. First, a sample of a verticle display.
[mana]
type = verticle
frame = rhud.bmp
framealpha = a_rhud.bmp
indicator = hbar.bmp
indicatoralpha = a_hbar.bmp
framex = -100
framey = 0
indicatoroffsetx = 10
indicatoroffsety = 50
indicatorheight = 32
The attribute being displayed is mana. This must be defined in the
AttributeInfoFile (specified in the
PlayerSetup entity). If the attribute name is
LightValue
then the amount of time left in the player's light
is shown. This name does not need to be defined in the AttributeInfoFile.
The line type
defines which display type is to be used, in this
case verticle
.
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
attribute element. If these lines are missing then no frame will be shown. The
lines indicator
and indicatoralpha
define the
bitmap and alpha map used as the attribute indicator. If these lines are
missing then no indicator is shown.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at the
center of the screen width. If framey is equal to center
then the
center of the identifier bitmap is placed at the center of the screen height.
The lines indicatoroffsetx
and indicatoroffsety
define the x and y offset of the indicator from (framex, framey). This defines
the screen location of the indicator bitmap's upper left corner, relative to
the frame's location.
The line indicatorheight
defines the number of pixels from the
top of the indicator bitmap that will be used as the indicator graphic. This is
due to the fact that bitmap sizes must be even and a combination of powers of 2.
Therefore, the indicator graphic may not be the entire height of the bitmap.
Next, a sample of a horizontal display.
[dart]
type = horizontal
frame = rockhud.bmp
framealpha = a_darthud.bmp
indicator = sindic.bmp
indicatoralpha = a_sindic.bmp
framex = -64
framey = 96
indicatoroffsetx = 4
indicatoroffsety = 33
indicatorwidth = 27
The attribute being displayed is dart. This must be defined in the
AttributeInfoFile (specified in the
PlayerSetup entity). If the attribute name is
LightValue
then the amount of time left in the player's light
is shown. This name does not need to be defined in the AttributeInfoFile.
The line type
defines which display type is to be used, in this
case horizontal
.
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
attribute element. If these lines are missing then no frame will be shown. The
lines indicator
and indicatoralpha
define the
bitmap and alpha map used as the attribute indicator. If these lines are
missing then no indicator is shown.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at
the center of the screen width. If framey is equal to center
then the center of the identifier bitmap is placed at the center of the screen
height.
The lines indicatoroffsetx
and indicatoroffsety
define the x and y offset of the indicator from (framex, framey). This defines
the screen location of the indicator bitmap's upper left corner, relative to
the frame's location.
The line indicatorwidth
defines the number of pixels from the
left of the indicator bitmap that will be used as the indicator graphic.This is
due to the fact that bitmap sizes must be even and a combination of powers of 2.
Therefore, the indicator graphic may not be the entire width of the bitmap.
Indicators decrease from top to bottom (verticle
) or right to
left (horizontal
) by default. To make them decrease from bottom
to top or left to right add the line flipindicator = true
.
Finally, a sample of a numeric display.
[health]
type = numeric
frame = rhud.bmp
framealpha = a_rhud.bmp
framex = -100
framey = 0
indicatoroffsetx = 36
indicatoroffsety = 38
font = Tahoma
width = 3
The attribute being displayed is health. This must be defined in the
AttributeInfoFile (specified in the
PlayerSetup entity). If the attribute name is
LightValue
then the amount of time left in the player's light
is shown. This name does not need to be defined in the AttributeInfoFile.
The line type
defines which display type is to be used, in this
case numeric
.
The lines starting with frame
and framealpha
define the bitmap and alpha map used as the frame (or identifier) part of the
attribute element. If these lines are missing then no frame will be shown.
The lines framex
and framey
define where the
identifier is placed on the screen. If framex is greater than 0 then the x
location of the bitmap is that many pixels from the left side of the screen. If
framey is greater than 0 then the y location is that many pixels from the top
of the screen. If framex is less than 0 then the x location is that many pixels
from the right side of the screen. If framey is less than 0 then the y location
is that many pixels from the bottom of the screen. The (x,y) location defines
the upper left corner of the identifier bitmap in these cases. If framex equals
center
then the center of the identifier bitmap is placed at
the center of the screen width. If framey is equal to center
then the center of the identifier bitmap is placed at the center of the screen height.
The lines indicatoroffsetx
and indicatoroffsety
define the x and y offset of the text from (framex, framey). This defines the
screen location of the indicator text's upper left corner, relative to the
frame's location.
The line font
defines the font used to display the numeric text.
See Font XML Files for information on how to define a font.
The line width
defines the number of characters shown for the
attribute value. The default is 3.
The default setting for all Hud elements is active, which means they will be
displayed when the Hud is displayed. To stop an element from being displayed
add the line active = false
to the definition section. It will
then be necessary for the program to activate the element so it can be
displayed. At the moment only weapons activate and deactive their ammunition
Hud elements. Therefore, it is necessary to add the active = false
line to the Hud elements of all ammunition. When you switch to a weapon it will
deactivate all other ammunition Hud elements and active its ammunition display.
If the line is set to active = modify
then the Hud element will
be displayed only when the value is being changed. A modifydirection
line tells which way the change must take place in order for the Hud element to
be displayed. The choices are up
, down
, or
both
. A displaytime
line is used to specify the
amount of time the Hud element will continue to be displayed after the last time
its value changed.