Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "QuakeC Simple Types"

From Quake Wiki

Line 1: Line 1:
<H1><FONT COLOR="#007F00">The Quake-C Basic Types</FONT></H1>
 
  
 
+
== The simple Types ==
<h2>The simple Types</h2>
 
  
 
<h4>[[void]] type</h4>
 
<h4>[[void]] type</h4>

Revision as of 15:11, 8 May 2008

The simple Types

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!\ "
Use \ for newline.

Note: that character strings cannot be modified, or concatenated. Because they are stored at fixed locations in memory, and if would be postentially 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.