Next Previous Contents

2. The Q3TA Menu

2.1 Documentation syntax

Items in plain font is a keyword.

Items within square brackets ([]) are required.

Items within angle brackets (<>) are optional.

A ``string'' type can be optionally enclosed in double-quotes ("). This use of double-quotes is required if the string contains a space. Highly recommended to always use double-quotes for strings, if for no other reason than style consistency.

A ``int'' type is an integer number, negative or not, with no fractional (decimal) portion.

A ``float'' type is a floating point number, negative or not, with or without a fractional (decimal) portion.

A ``color'' type is four sequential floats, indicating a RGBA value. Each float corresponds to:

  1. Red component
  2. Green component
  3. Blue component
  4. Alpha component

Each component is given a value from zero (none) to one (full). Zero alpha is full transparency (invisible), with one being full opacity. Partial values are fractional numbers between 0 and 1 (e.g. "0.58").

A ``rect'' type is four sequential ints. The four numbers correspond to:

  1. Horizontal (X) position of the rectangle's upper-left corner
  2. Vertical (Y) position of the rectangle's upper-left corner
  3. Width of the rectangle
  4. Height of the rectangle

The coordinates are scaled to a 640x480 screen: horizontal values range from 0 to 640, vertical values range from 0 to 480. So even if the screen resolution is 1600x1200, "(320, 240)" (half of 640, half of 480) still means the center of the screen. "0 0 640 480" is full-screen.

The special marker XXX indicates meta-notes/hints about incompleteness in some form.

2.2 Menu Layout

The description of menus can lay across many files. In fact, the Quake III: Team Arena main menu is described across more than 30 files. There are three main components to the menu system:

  1. menuloader
  2. menu definition (menuDef)
  3. item definition (itemDef)

Items are the individual parts of a menu that actually carry out actions. Menus are logical (and physical) groupings of items. Submenus are possible, but not directly (i.e. no defining a menu inside a menu); instead, an item may open another menu, then re-open the previous menu upon closing, creating a submenu effect. Menuloader lists menus to prepare for display, and, in a sense, groups menus.

2.3 Menu Format

The format is loosely based on the programming language C. `menuDef' and `itemDef' describe groupings that can be compared to C function or structs. These two define their bodies within curly braces ({}). Both `menuDef' and `itemDef' are composed of ``statements'' that end with a semicolon. An `itemDef' can only be nested inside a `menuDef'. This means no nesting an `itemDef' inside another `itemDef'. `menuDef' cannot be nested inside anything else.

Next Previous Contents