file.menu Explained



The HUD is defined by the file

any_name.menu


This file has to start with the line

#include "ui/menudef.h"





The default files I found start with the following lines:

assetGlobalDef {
cursor "ui/assets/3_cursor2" // cursor
gradientBar "ui/assets/gradientbar2.tga" // gradient bar
fadeClamp 1.0 // sets the fadeup alpha
fadeCycle 1 // how often fade happens in milliseconds
fadeAmount 0.1 // amount to adjust alpha per cycle

shadowX 5 // x amount for shadow offset
shadowY 5 // y amount for shadow offset
shadowColor 0.1 0.1 0.1 0.25 // shadow color

font "fonts/font" 24 // font
smallFont "fonts/smallfont" 16 // font
bigFont "fonts/bigfont" 48 // font
}



I erased them from the file and everything works just the same.
(I will keep experimenting)



menuDef and itemDef


As you can read in the Position section the .menu file defines areas of the screen where information is displayed.

Such areas are defined in the menuDef sections.

menuDef{

}




Contained by the menuDef you can find one or more itemDef sections.

menuDef {

itemDef{
}

itemDef{
}

}



The itemDef sections contain the elements to display (ammo and health value, icons, bars, timer, etc.)



menuDef lines

Let's look at an example:

menuDef{

ownerdrawflag CG_SHOW_IF_PLAYER_HAS_FLAG
name "Whatever_you_want"
fullScreen MENU_FALSE
visible MENU_TRUE
style WINDOW_STYLE_FILLED
backcolor 0 0 0 .5
rect 280 300 82 62



What do these lines mean?

onwerdrawflag
Optional.
The elements will be displayed only if the condition is true.
Later, I'll post a list of the possible values for ownerdrawflag.


name
Optional.
It can be whatever you want.


fullScreen MENU_FALSE
Appears to be optional.
Not sure what it does. Put it there just in case.
MENU_FALSE = 0


visible MENU_TRUE
Makes the element visible.
MENU_TRUE = 1


style WINDOW_STYLE_FILLED
backcolor 0 0 0 .5
background "ui/assets/hud/scoreboxm.tga"
Optional.
backcolor indicates the background color.
background indicates an image.
style WINDOW_STYLE_FILLED is necessary if you want a color or image background.
The image will be drawn with the color defined by backcolor.
1st number: red (0-1)
2nd number: green (0-1)
3rd number: blue (0-1)
4th number: transparency (0-1)
If you want to display the image using its original colors use WINDOW_STYLE_SHADER
You can use WINDOW_STYLE_GRADIENT too.
0 = WINDOW_STYLE_EMPTY
1 = WINDOW_STYLE_FILLED
2 = WINDOW_STYLE_GRADIENT
3 = WINDOW_STYLE_SHADER


rect 280 300 82 62
Defines an the position and size of the area to display the info.
(It doesn't seem to be a problem if the area is too small for the elements to display)
1st number: position x (left to right, 0-640)
2nd number: position y (top to bottom, 0-480)
3rd number: size x (horizontal)
4th number: size y (vertical)




itemDef lines


name "whatever_you_want"
Optional


rect 29 6 32 32
Defines the position relative to the upper-left corner of the area defined in the menuDef section.
It defines the size of icons and background images.
Text is not affected by the size of the area.
Text is displayed center-aligned at the bottom of the defined area.
1st number: position x (left to right)
2nd number: position y (top to bottom)
3rd number: size x (horizontal)
4th number: size y (vertical)


style WINDOW_STYLE_FILLED
backcolor 1 1 1 1
background "icons/Icona_plasma.tga"
Optional.
backcolor indicates the background color.
background indicates an image.
style WINDOW_STYLE_FILLED is necessary if you want a color or image background.
The image will be drawn with the color defined by backcolor.
1st number: red (0-1)
2nd number: green (0-1)
3rd number: blue (0-1)
4th number: transparency (0-1)
If you want to display the image using its original colors use WINDOW_STYLE_SHADER
You can use WINDOW_STYLE_GRADIENT too.
0 = WINDOW_STYLE_EMPTY
1 = WINDOW_STYLE_FILLED
2 = WINDOW_STYLE_GRADIENT
3 = WINDOW_STYLE_SHADER


visible 1
Makes the element visible


decoration
It appears to be optional with most items.
But it seems necessary for
CG_RED_CLAN_PLYRS
CG_BLUE_CLAN_PLYRS
CG_1ST_PLACE_SCORE
CG_2ND_PLACE_SCORE
and, sometimes, images.
If you don't put it there, some items might not be displayed sometimes.


forecolor 1 0 .57 .8
Optional.
Color of the text.
The values (left to right) mean:
RED 0-1
GREEN 0-1
BLUE 0-1
TRANSPARENCY 0-1 (0 means invisible, 1 is solid color)


text "Any text you want"
display text.


textscale .6
Optional.
Defines the size of the text.


textstyle 3
Optional.
1 = blinking text
2 = text without shadow
3 = text with shadow


textalign
textalignx
textaligny
These don't seem to work. You don't need them anyway.


background "ui/assets/hud/chatl.tga"
ownerdraw CG_TEAM_COLORIZED
Used by some elements (health and ammo bars, score displays).
background defines a background image.
(Later, I'll post a list of the possible values for background)
ownerdraw CG_TEAM_COLORIZED makes that image red or blue for team games and yellow for non team games.
It is NOT possible to use your own images.
Important:
First, use one itemDef to define the background.
Then, use another itemDef to display a value or an icon.


ownerdraw CG_PLAYER_AMMO_ICON2D
ownerdraw indicates the element to be displayed (ammo and health values, icons, bars, etc.).
(CG_PLAYER_AMMO_ICON displays a 3D icon)
Later, I'll post a list of the possible values for ownerdraw.


addColorRange 0 50 1 .7 0 .5
Optional.
Numbers can be displayed with a different color depending of the value.
1st number: lowest value of the range.
2nd number: highest value of the range.
3rd number: red (0-1)
4th number: green (0-1)
5th number: blue (0-1)
6th number: transparency (0-1)
(for example: you could use this to display your health
yellow for values 101-200
orange 51-100
red 0-50
or any color and value ranges you want)





I hope it helps. If anything is not clear, leave a post with your questions.

3 comments:

  1. yea, how do u strefjump with hud?

    ReplyDelete
  2. the hud is the information you see on your screen.

    if you want to train strafe jumping

    http://www.youtube.com/watch?v=gfb_kwvhQ9c&feature=related

    RAZ3r training map:
    http://www.quakelive.com/forum/showthread.php?t=18447&highlight=raz3r+training

    ReplyDelete
  3. LOL!!!

    I bet that wasn't one of the comments or questions that you were thinking about. Anyways,

    Thanks alot for this site. You have been a big help in my understanding of this syntax.

    Really appreciate it.

    ReplyDelete