QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ex_state_t Struct Reference

State expression used for think function state-machines. More...

Collaboration diagram for ex_state_t:
[legend]

Data Fields

struct expr_sframe
 the frame to which to change in this state More...
 
struct expr_sstep
 time step until the next state More...
 
struct expr_sthink
 think function for the next state More...
 

Detailed Description

State expression used for think function state-machines.

State expressions are of the form [framenum, nextthink] (standard) or [framenum, nextthink, timestep] (QF extension) and come before the opening brace of the function. If the state expression is of the former form, then step will be null. Normally, framenum and nextthink must be constant (though nextthink may be a forward reference), but qfcc allows both framenum and nextthink, and also timestep, to be variable.

From qcc:
States are special functions made for convenience. They automatically set frame, nextthink (implicitly), and think (allowing forward definitions).
void() name = [framenum, nextthink] {code};

expands to:

void name ()
{
     self.frame=framenum;
     self.nextthink = time + 0.1;
     self.think = nextthink
     [code]
};

Although the above expansion shows three expressions, a state expression using constant values is just one instruction: either state framenum, nextthink (standard) or state.f framenum, nextthink, timestep (QF, optional).

Field Documentation

struct expr_s* frame

the frame to which to change in this state

struct expr_s* step

time step until the next state

struct expr_s* think

think function for the next state


The documentation for this struct was generated from the following file: