EXT CSQC System Globals Fields and Builtins List

From Quake Wiki

Revision as of 02:32, 25 March 2013 by Hectate (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

System Globals

entity		self;
entity		other;
entity		world;
float		time;
float		frametime;

float 		player_localentnum;     //the entnum
float 		player_localnum;        //the playernum
float		maxclients;             //a constant filled in by the engine

float		clientcommandframe;     //player movement
float		servercommandframe;     //clientframe echoed off the server
string		mapname;

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

// set by traceline / tracebox
float		trace_allsolid;
float		trace_startsolid;
float		trace_fraction;
vector		trace_endpos;
vector		trace_plane_normal;
float		trace_plane_dist;
entity		trace_ent;
float		trace_inopen;
float		trace_inwater;

//
// required prog functions
//
void()		CSQC_Init;
void()		CSQC_Shutdown;
float(float f, float t, float n)	CSQC_InputEvent;
void()		CSQC_UpdateView;
float(string s)	CSQC_ConsoleCommand;

//these fields are read and set by the default player physics
vector		pmove_org;
vector		pmove_vel;
vector		pmove_mins;
vector		pmove_maxs;
//retrieved from the current movement commands (read by player physics)
float		input_timelength;
vector		input_angles;
vector		input_movevalues;  //forwards, right, up.
float		input_buttons;     //attack, use, jump (default physics only uses jump)

float		movevar_gravity;
float		movevar_stopspeed;
float		movevar_maxspeed;
float		movevar_spectatormaxspeed;  //used by NOCLIP movetypes.
float		movevar_accelerate;
float		movevar_airaccelerate;
float		movevar_wateraccelerate;
float		movevar_friction;
float		movevar_waterfriction;
float		movevar_entgravity;	//the local player's gravity field. Is a multiple
		                        //(1 is the normal value)

System Fields

.float		modelindex;     // *** model index in the precached list
.vector		absmin, absmax;	// *** origin + mins / maxs

.float		entnum;         // *** the ent number as on the server
.float		drawmask;
.void()		predraw;
.float		movetype;
.float		solid;

.vector		origin;         // ***
.vector		oldorigin;      // ***
.vector		velocity;
.vector		angles;
.vector		avelocity;

.string		classname;      // spawn function
.string		model;
.float		frame;
.float		skin;
.float		effects;

.vector		mins, maxs;     // bounding box extents reletive to origin
.vector		size;           // maxs - mins

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

.float		nextthink;
.entity		chain;
.string		netname;
.entity 	enemy;
.float		flags;
.float		colormap;
.entity		owner;

Builtins

CSQC implements all the core quake functions except for:

  • checkclient
  • stuffcmd
  • bprint
  • sprint (use 'print' instead)
  • aim
  • writebyte
  • writechar
  • writeshort
  • writelong
  • writecoord
  • writeangle
  • writestring
  • writeentity
  • precache_file
  • changelevel
  • logfrag (qw)
  • infokey (qw)
  • multicast (qw)
// core functions from standard quake
void(vector ang) makevectors = #1;
void(entity e, vector o) setorigin = #2;
void(entity e, string m) setmodel = #3;
void(entity e, vector min, vector max) setsize = #4;
void(entity e, vector min, vector max) setabssize = #5;
void() break = #6;
float() random = #7;
void(entity e, float chan, string samp) sound = #8;
vector(vector v) normalize = #9;
void(string e) error = #10;
void(string e) objerror = #11;
float(vector v) vlen = #12;
float(vector v) vectoyaw = #13;
entity() spawn = #14;
void(entity e) remove = #15;
float(vector v1, vector v2, float tryents) traceline = #16;
entity() checkclient = #17;
entity(entity start, .string fld, string match) find = #18;
void(string s) precache_sound = #19;
void(string s) precache_model = #20;
entity(vector org, float rad) findradius = #22;

string(float f) ftos = #26;
string(vector v) vtos = #27;
void() coredump = #28;
void() traceon = #29;
void() traceoff = #30;
void(entity e) eprint = #31;
float(float yaw, float dist) walkmove = #32;

float() droptofloor = #34;
void(float style, string value) lightstyle = #35;
float(float v) rint = #36;
float(float v) floor = #37;
float(float v) ceil = #38;

float(entity e) checkbottom = #40;
float(vector v) pointcontents = #41;

float(float f) fabs = #43;
float(string s) cvar = #45;
void(string s) localcmd = #46;
entity(entity e) nextent = #47;
void(vector o, vector d, float color, float count) particle = #48;
void() ChangeYaw = #49;

vector(vector v) vectoangles = #51;

string(string s) precache_file = #68;
void(entity e) makestatic = #69;

void(string var, string val) cvar_set = #72;

void(vector pos, string samp, float vol, float atten) ambientsound = #74;
string(string s) precache_model2 = #75;
string(string s) precache_sound2 = #76;
string(string s) precache_file2 = #77;



// core ext_csqc functions
void() R_ClearScene = #300;
void(float mask) R_AddEntities = #301;
void(entity ent) R_AddEntity = #302;
float(float property, ...) R_SetView = #303;
void() R_RenderScene = #304;
void(vector org, float radius, vector lightcolours) R_AddDynamicLight = #305;
void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
void() R_EndPolygon = #308;

vector (vector v) cs_unproject = #310;
vector (vector v) cs_project = #311;

void(float width, vector pos1, vector pos2, float flag) drawline = #315;
float(string name) iscachedpic = #316;
string(string name) precache_pic = #317;
vector(string picname) draw_getimagesize = #318;
void(string name) freepic = #319;
float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
void(float x, float y, float width, float height) drawsetcliparea = #324;
void(void) drawresetcliparea = #325;
float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #326;

float (float statnum) getstat_float = #330;
float (float statnum) getstat_float_truncated = #331;
string (float statnum) getstat_string = #332;

void(entity e, float mdlindex) setmodelindex = #333;
string(float mdlindex) modelnameforindex = #334;
float(string effectname) particleeffectnum = #335;
void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
void(string s, ...) centerprint = #338;
void(string s, ...) print = #339;
string(float keynum) keynumtostring = #340;
float(string keyname) stringtokeynum = #341;
string(float keynum) getkeybind = #342;
void(float usecursor) setcursormode = #343;
vector() getmousepos = #344;
float(float framenum) getinputstate = #345;
void(float sens) setsensitivityscaler = #346;
void() runstandardplayerphysics = #347;
string(float playernum, string keyname) getplayerkeyvalue = #348;
float() isdemo = #349;
float() isserver = #350;
void(vector origin, vector forward, vector right, vector up) SetListener = #351;
void(string cmdname) registercommand = #352;
float(entity ent) wasfreed = #353;
string(string key) serverkey = #354;

float() ReadByte = #360;
float() ReadChar = #361;
float() ReadShort = #362;
float() ReadLong = #363;
float() ReadCoord = #364;
float() ReadAngle = #365;
string() ReadString = #366;	//warning: this returns a temporary!
float() ReadFloat = #367;

Constants

// add-entity mask bits
float MASK_ENGINE           = 1;
float MASK_ENGINEVIEWMODELS = 2;
float MASK_NORMAL           = 4;

// renderflag bits
float RF_VIEWMODEL          = 1;
float RF_EXTERNALMODEL      = 2;
float RF_DEPTHHACK          = 4;
float RF_ADDITIVE           = 8;
float RF_USEAXIS            = 16;

// flags for 2d drawing
float DRAWFLAG_NORMAL       = 0;
float DRAWFLAG_ADDITIVE     = 1;
float DRAWFLAG_MODULATE     = 2;
float DRAWFLAG_2XMODULATE   = 3;

// setview parameter
float VF_MIN                = 1;    //(vector)
float VF_MIN_X              = 2;    //(float)
float VF_MIN_Y              = 3;    //(float)
float VF_SIZE               = 4;    //(vector) (viewport size)
float VF_SIZE_X             = 5;    //(float)
float VF_SIZE_Y             = 6;    //(float)
float VF_VIEWPORT           = 7;    //(vector, vector)
float VF_FOV                = 8;    //(vector)
float VF_FOVX               = 9;    //(float)
float VF_FOVY               = 10;   //(float)
float VF_ORIGIN             = 11;   //(vector)
float VF_ORIGIN_X           = 12;   //(float)
float VF_ORIGIN_Y           = 13;   //(float)
float VF_ORIGIN_Z           = 14;   //(float)
float VF_ANGLES             = 15;   //(vector)
float VF_ANGLES_X           = 16;   //(float)
float VF_ANGLES_Y           = 17;   //(float)
float VF_ANGLES_Z           = 18;   //(float)
float VF_DRAWWORLD          = 19;   //(float)
float VF_DRAWENGINESBAR     = 20;   //(float)
float VF_DRAWCROSSHAIR      = 21;   //(float)

float VF_CL_VIEWANGLES      = 33;   //(vector)
float VF_CL_VIEWANGLES_X    = 34;   //(float)
float VF_CL_VIEWANGLES_Y    = 35;   //(float)
float VF_CL_VIEWANGLES_Z    = 36;   //(float)

float VF_PERSPECTIVE        = 200;  //(float)

// stats
// 0 - 31 are reserved for standard engine stats
// 32 - 128 are for QuakeC modders
float STAT_HEALTH           = 0;
float STAT_WEAPONMODEL      = 2;
float STAT_AMMO             = 3;
float STAT_ARMOR            = 4;
float STAT_WEAPONFRAME      = 5;
float STAT_SHELLS           = 6;
float STAT_NAILS            = 7;
float STAT_ROCKETS          = 8;
float STAT_CELLS            = 9;
float STAT_ACTIVEWEAPON     = 10;
float STAT_TOTALSECRETS     = 11;
float STAT_TOTALMONSTERS    = 12;
float STAT_SECRETS          = 13; // bumped on client side by svc_foundsecret
float STAT_MONSTERS         = 14; // bumped by svc_killedmonster
float STAT_ITEMS            = 15; // self.items bitmask from server
float STAT_VIEWHEIGHT       = 16;

// buttons for input_buttons
float BUTTON_ATTACK         = 1;
float BUTTON_JUMP           = 2;
float BUTTON_3              = 4;
float BUTTON_4              = 8;
float BUTTON_5              = 16;
float BUTTON_6              = 32;
float BUTTON_7              = 64;
float BUTTON_8              = 128;
// supported by DarkPlaces
float BUTTON_USE            = 256;
float BUTTON_CHAT           = 512;
float BUTTON_PRYDONCURSOR   = 1024;
float BUTTON_9              = 2048;
float BUTTON_10             = 4096;
float BUTTON_11             = 8192;
float BUTTON_12             = 16384;
float BUTTON_13             = 32768;
float BUTTON_14             = 65536;
float BUTTON_15             = 131072;
float BUTTON_16             = 262;

Non-System Fields and Globals

float  intermission; // initially FALSE, set to TRUE when the server sends the SVC_INTERMISSION command