QuakeWiki
October 1, 2012

CSQC definitions file

Copy and paste the following into a .qc file such as a csqc_defs.qc. We’ll be adding this to the top of our .src file to compile it and holds the important field and global variable definitions for our CSQC.

//
// system globals
//
entityself;
entityother;
entityworld;
floattime;
floatframetime;

float player_localentnum;//the entnum
float player_localnum;//the playernum
floatmaxclients;//a constant filled in by the engine. gah, portability eh?

floatclientcommandframe;//player movement
floatservercommandframe;//clientframe echoed off the server

stringmapname;

//
// global variables set by built in functions
//
vectorv_forward, v_up, v_right;// set by makevectors()

// set by traceline / tracebox
floattrace_allsolid;
floattrace_startsolid;
floattrace_fraction;
vectortrace_endpos;
vectortrace_plane_normal;
floattrace_plane_dist;
entitytrace_ent;
floattrace_inopen;
floattrace_inwater;

//
// required prog functions
//
void()CSQC_Init;
void()CSQC_Shutdown;
float(float event, float param, float param2)CSQC_InputEvent;
void(float width, float height, float menushown) CSQC_UpdateView;
void(string s)CSQC_ConsoleCommand;

//these fields are read and set by the default player physics
vectorpmove_org;
vectorpmove_vel;
vectorpmove_mins;
vectorpmove_maxs;
//retrieved from the current movement commands (read by player physics)
floatinput_timelength;
vectorinput_angles;
vectorinput_movevalues;//forwards, right, up.
floatinput_buttons;//attack, use, jump (default physics only uses jump)

floatmovevar_gravity;
floatmovevar_stopspeed;
floatmovevar_maxspeed;
floatmovevar_spectatormaxspeed;//used by NOCLIP movetypes.
floatmovevar_accelerate;
floatmovevar_airaccelerate;
floatmovevar_wateraccelerate;
floatmovevar_friction;
floatmovevar_waterfriction;
floatmovevar_entgravity;//the local player's gravity field. Is a multiple (1 is the normal value)

//================================================
voidend_sys_globals;// flag for structure dumping
//================================================

/*
==============================================================================

SOURCE FOR ENTVARS_T C STRUCTURE

==============================================================================
*/
//
// system fields (*** = do not set in prog code, maintained by C code)
//
.floatmodelindex;// *** model index in the precached list
.vectorabsmin, absmax;// *** origin + mins / maxs

.floatentnum;// *** the ent number as on the server
.floatdrawmask;
.void()predraw;

.floatmovetype;
.floatsolid;

.vectororigin;// ***
.vectoroldorigin;// ***
.vectorvelocity;
.vectorangles;
.vectoravelocity;

.stringclassname;// spawn function
.stringmodel;
.floatframe;
.floatskin;
.floateffects;

.vectormins, maxs;// bounding box extents reletive to origin
.vectorsize;// maxs - mins

.void()touch;
.void()use;
.void()think;
.void()blocked;// for doors or plats, called when can't push other

.floatnextthink;

.entitychain;

.stringnetname;

.entity enemy;

.floatflags;

.floatcolormap;

.entityowner;// who launched a missile

//================================================
voidend_sys_fields;// flag for structure dumping
//================================================

Pagespeed Optimization by Lighthouse.