text
stringlengths
0
774
If you declare a vector foobar, then you can access it's x, y and z fields with the float types: foobar_x,
foobar_y, and foobar_z.
String Types
string_declaration ⇒ string name
Represents a character string. Used to indicate file names, or messages to be broadcast to players. Use
”\n “ for a newline. The \" escape can be used to include a quotation mark (“) in the string.
Entity Types
entity_declaration ⇒ entity name
An entity represents objects in the game, like things, players, and monsters. For instance, this is the type
of the entities self and other. The entity type is a structured type, made of fields."</s>
<s>[INST] What are Field Types in QuakeC?[/INST]
" Contrary to the other types, the entity type is a reference to an instance of a structured object that contains
information of many different kinds, stored as fields of the entity object. Each field is given a name and a
type.
Some of the fields do not store values; instead, they store the function to be executed under certain
conditions, called methods.
If QuakeC was an object oriented programming language, method functions would be distinguished from
the other fields and you would be able to create new object types, with their own fields.
As QuakeC stands currently, all the field definitions are definitions of entity fields. So, anywhere in your
code you could add definition of new fields, and the compiler would interpret them as an extension of the
entity definition.
Here are all the possible definitions of entity fields, with their types:
.float name
.string name
.vector name
.entity name"</s>
<s>[INST] What are Reserved Field Types in QuakeC?[/INST]
" Reserved Field Types
In the first file read by the QuakeC compiler, DEFS.QC, there must be a definition for the entity fields and
world fields. This definition is hard coded, and cannot be changed without requiring a recompilation of the
core Quake engine.
In DEFS.QC, globals are defined before the special definition “void end_sys_globals;“, while the
entity fields are defined before the special definition “void end_sys_fields;”. It's not important to
understand the tags, just don't modify DEFS.QC before those two tags, and you won't be in trouble. Better
yet, avoid modifying DEFS.QC altogether and use header files to define entity fields, globals, constants,
and prototypes."</s>
<s>[INST] What are Definitions of Variables in QuakeC?[/INST]
" variable_declaration ⇒ [local] simple_type name [ = immediate][, name][ =
<immediate>] …
There are two levels of scoping. By default all variables are global: they can be accessed by any
functions, and they are shared by all the functions (and all the clients of a given network server, of course).
Note that variables cannot be givien an initial default value as part of their declaration.
Using the keyword local just before the declaration of a variable, makes the variable(s) visible only to the
function itself (i.e. it will be allocated on the stack).
Note that parameters of functions are treated like local variables, they are only visible to the function, but
they can be modified."</s>
<s>[INST] What are Definitions of Constants in QuakeC?[/INST]
" Definition of Constants (Immediates)
constant_declaration ⇒ simple_type name = value
Any global variable that is initialized by setting a value to it is actually assumed to be a constant. Since a
constant is in fact represented by immediate values, you should NEVER attempt to modify a constant by
giving it another value. Also, do not use another constant as the value for a constant. literals should only
be used as the values for constants."</s>
<s>[INST] What are Names in QuakeC?[/INST]
" Names can denote declared entities, whether declared explicitly or implicitly (see 3.1). Names can also
denote objects or subprograms designated by access values; the results of function_calls; protected
subprograms, single entries, entry families, and entries in families of entries. Finally, names can denote
attributes of any of the foregoing."</s>
<s>[INST] What are expressions in QuakeC?[/INST]
" An expression is a formula that defines the computation or retrieval of a value."</s>
<s>[INST] What are Operators and Expression Evaluation in QuakeC?[/INST]
" The language defines the following five categories of operators (given in order of increasing precedence):
Logical Operators:
&& // logical AND
|| // logical OR
! // logical NOT
Take care that in if () conditional expressions containing two or more logical clauses, all the clauses will
be evaluated before the condition test (like in BASIC, and unlike C). That means that if one part of your
condition is not always valid or defined, you had better decompose your if() into two successive if()
statements, which should also make it faster.
Relational Operators:
<= // less than or equal to
< // less than
>= // greater than or equal to
> // greater than
== // equal, like in C.
!= // not equal, like in C.
Binary Adding Operators:
+ // addition
- // subtraction
& // bitwise AND
| // bitwise OR
Unary Adding Operators:
+ // identity
- // negation
Multiplying Operators:
* // multiplication
/ // division"</s>
<s>[INST] What are Statements in QuakeC?[/INST]
" A statement is either simple or compound. A simple_statement encloses no other statement.