QuakeC Simple Types

From Quake Wiki

Revision as of 02:15, 5 April 2013 by Necros (talk | contribs) (The simple Types)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The simple Types[edit]

void type

An empty result, mostly used for definition of procedures (i.e. functions that return no result at all).

Float type

A floating point value.

Floats are also used to store booleans (TRUE, FALSE) or integer values link counters, or bit flags.

    Valid syntax: 12  1.6  0.5  -100
    Invalid syntax: .5  -.50  .690

A parsing ambiguity is present with negative constants. "a-5" will be parsed as "a", then "-5", causing an error. Separate the - from the digits with a space "a - 5" to get the proper behavior.

Vector type

A vector, made of 3 float coordinates.
Used to represent positions or directions in 3D space.
Valid syntax: '0 0 0' or '20.5 -10 0.00001'

Note the simple quotes around the vector. Do not use double quotes, they are reserved for strings.

If you declare a vector foobar, then you can access it's x, y and z fields with: foobar_x, foobar_y,foobar_z.

String type

This is used to store character string.
Used to indicate file names, or messages to be broadcast to players.
Valid syntax: "maps/jrwiz1.bsp" or "ouch!\n"
Use \n for newline.

Note: that character strings cannot be modified, or concatenated. Because they are stored at fixed locations in memory, and if would be potentially troublesome to allow modification.

entity type

The reference of an entity in the game, like things, players, monsters.
For instance, this is the type of the entities self and other.

The entity type is a structured type, made of fields.
A description of each field is available.