692 lines
17 KiB
C++
692 lines
17 KiB
C++
|
|
/*
|
|
==============================================================================
|
|
|
|
source for globalvars_t c structure
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
//
|
|
// system globals
|
|
//
|
|
entity self;
|
|
entity other;
|
|
entity world;
|
|
float time;
|
|
float frametime;
|
|
|
|
float force_retouch; // force all entities to touch triggers
|
|
// next frame. this is needed because
|
|
// non-moving things don't normally scan
|
|
// for triggers, and when a trigger is
|
|
// created (like a teleport trigger), it
|
|
// needs to catch everything.
|
|
// decremented each frame, so set to 2
|
|
// to guarantee everything is touched
|
|
string mapname;
|
|
|
|
float deathmatch;
|
|
float coop;
|
|
float teamplay;
|
|
|
|
float serverflags; // propagated from level to level, used to
|
|
// keep track of completed episodes
|
|
|
|
float total_secrets;
|
|
float total_monsters;
|
|
|
|
float found_secrets; // number of secrets found
|
|
float killed_monsters; // number of monsters killed
|
|
|
|
|
|
// spawnparms are used to encode information about clients across server
|
|
// level changes
|
|
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
|
|
|
|
//
|
|
// 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;
|
|
|
|
entity msg_entity; // destination of single entity writes
|
|
|
|
//
|
|
// required prog functions
|
|
//
|
|
void() main; // only for testing
|
|
|
|
void() startframe;
|
|
|
|
void() playerprethink;
|
|
void() playerpostthink;
|
|
|
|
void() clientkill;
|
|
void() clientconnect;
|
|
void() putclientinserver; // call after setting the parm1... parms
|
|
void() clientdisconnect;
|
|
|
|
void() setnewparms; // called when a client first connects to
|
|
// a server. sets parms so they can be
|
|
// saved off for restarts
|
|
|
|
void() setchangeparms; // call to set parms for self so they can
|
|
// be saved for a level transition
|
|
|
|
|
|
//================================================
|
|
void end_sys_globals; // flag for structure dumping
|
|
//================================================
|
|
|
|
/*
|
|
==============================================================================
|
|
|
|
source for entvars_t c structure
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
//
|
|
// system fields (*** = do not set in prog code, maintained by c code)
|
|
//
|
|
.float modelindex; // *** model index in the precached list
|
|
.vector absmin, absmax; // *** origin + mins / maxs
|
|
|
|
.float ltime; // local time for entity
|
|
.float movetype;
|
|
.float solid;
|
|
|
|
.vector origin; // ***
|
|
.vector oldorigin; // ***
|
|
.vector velocity;
|
|
.vector angles;
|
|
.vector avelocity;
|
|
|
|
.vector punchangle; // temp angle adjust from damage or recoil
|
|
|
|
.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 groundentity;
|
|
|
|
// stats
|
|
.float health;
|
|
.float frags;
|
|
.float weapon; // one of the it_shotgun, etc flags
|
|
.string weaponmodel;
|
|
.float weaponframe;
|
|
.float currentammo;
|
|
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
|
|
|
|
.float items; // bit flags
|
|
|
|
.float takedamage;
|
|
.entity chain;
|
|
.float deadflag;
|
|
|
|
.vector view_ofs; // add to origin to get eye point
|
|
|
|
|
|
.float button0; // fire
|
|
.float button1; // use
|
|
.float button2; // jump
|
|
|
|
.float impulse; // weapon changes
|
|
|
|
.float fixangle;
|
|
.vector v_angle; // view / targeting angle for players
|
|
.float idealpitch; // calculated pitch angle for lookup up slopes
|
|
|
|
|
|
.string netname;
|
|
|
|
.entity enemy;
|
|
|
|
.float flags;
|
|
|
|
.float colormap;
|
|
.float team;
|
|
|
|
.float max_health; // players maximum health is stored here
|
|
|
|
.float teleport_time; // don't back up
|
|
|
|
.float armortype; // save this fraction of incoming damage
|
|
.float armorvalue;
|
|
|
|
.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
|
|
.float watertype; // a contents value
|
|
|
|
.float ideal_yaw;
|
|
.float yaw_speed;
|
|
|
|
.entity aiment;
|
|
|
|
.entity goalentity; // a movetarget or an enemy
|
|
|
|
.float spawnflags;
|
|
|
|
.string target;
|
|
.string targetname;
|
|
|
|
// damage is accumulated through a frame. and sent as one single
|
|
// message, so the super shotgun doesn't generate huge messages
|
|
.float dmg_take;
|
|
.float dmg_save;
|
|
.entity dmg_inflictor;
|
|
|
|
.entity owner; // who launched a missile
|
|
.vector movedir; // mostly for doors, but also used for waterjump
|
|
|
|
.string message; // trigger messages
|
|
|
|
.float sounds; // either a cd track number or sound number
|
|
|
|
.string noise, noise1, noise2, noise3; // contains names of wavs to play
|
|
|
|
//================================================
|
|
void end_sys_fields; // flag for structure dumping
|
|
//================================================
|
|
|
|
/*
|
|
==============================================================================
|
|
|
|
vars not referenced by c code
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
|
|
//
|
|
// constants
|
|
//
|
|
|
|
float false = 0;
|
|
float true = 1;
|
|
|
|
// edict.flags
|
|
float fl_fly = 1;
|
|
float fl_swim = 2;
|
|
float fl_client = 8; // set for all client edicts
|
|
float fl_inwater = 16; // for enter / leave water splash
|
|
float fl_monster = 32;
|
|
float fl_godmode = 64; // player cheat
|
|
float fl_notarget = 128; // player cheat
|
|
float fl_item = 256; // extra wide size for bonus items
|
|
float fl_onground = 512; // standing on something
|
|
float fl_partialground = 1024; // not all corners are valid
|
|
float fl_waterjump = 2048; // player jumping out of water
|
|
float fl_jumpreleased = 4096; // for jump debouncing
|
|
|
|
// edict.movetype values
|
|
float movetype_none = 0; // never moves
|
|
//float movetype_anglenoclip = 1;
|
|
//float movetype_angleclip = 2;
|
|
float movetype_walk = 3; // players only
|
|
float movetype_step = 4; // discrete, not real time unless fall
|
|
float movetype_fly = 5;
|
|
float movetype_toss = 6; // gravity
|
|
float movetype_push = 7; // no clip to world, push and crush
|
|
float movetype_noclip = 8;
|
|
float movetype_flymissile = 9; // fly with extra size against monsters
|
|
float movetype_bounce = 10;
|
|
float movetype_bouncemissile = 11; // bounce with extra size
|
|
|
|
// edict.solid values
|
|
float solid_not = 0; // no interaction with other objects
|
|
float solid_trigger = 1; // touch on edge, but not blocking
|
|
float solid_bbox = 2; // touch on edge, block
|
|
float solid_slidebox = 3; // touch on edge, but not an onground
|
|
float solid_bsp = 4; // bsp clip, touch on edge, block
|
|
|
|
// range values
|
|
float range_melee = 0;
|
|
float range_near = 1;
|
|
float range_mid = 2;
|
|
float range_far = 3;
|
|
|
|
// deadflag values
|
|
|
|
float dead_no = 0;
|
|
float dead_dying = 1;
|
|
float dead_dead = 2;
|
|
float dead_respawnable = 3;
|
|
|
|
// takedamage values
|
|
|
|
float damage_no = 0;
|
|
float damage_yes = 1;
|
|
float damage_aim = 2;
|
|
|
|
// items
|
|
float it_axe = 4096;
|
|
float it_shotgun = 1;
|
|
float it_super_shotgun = 2;
|
|
float it_nailgun = 4;
|
|
float it_super_nailgun = 8;
|
|
float it_grenade_launcher = 16;
|
|
float it_rocket_launcher = 32;
|
|
float it_lightning = 64;
|
|
float it_extra_weapon = 128;
|
|
|
|
float it_shells = 256;
|
|
float it_nails = 512;
|
|
float it_rockets = 1024;
|
|
float it_cells = 2048;
|
|
|
|
float it_armor1 = 8192;
|
|
float it_armor2 = 16384;
|
|
float it_armor3 = 32768;
|
|
//med 11/02/96 added new hip weapon removed superhealth
|
|
//float it_superhealth = 65536;
|
|
|
|
float it_key1 = 131072;
|
|
float it_key2 = 262144;
|
|
|
|
float it_invisibility = 524288;
|
|
float it_invulnerability = 1048576;
|
|
float it_suit = 2097152;
|
|
float it_quad = 4194304;
|
|
|
|
// point content values
|
|
|
|
float content_empty = -1;
|
|
float content_solid = -2;
|
|
float content_water = -3;
|
|
float content_slime = -4;
|
|
float content_lava = -5;
|
|
float content_sky = -6;
|
|
|
|
float state_top = 0;
|
|
float state_bottom = 1;
|
|
float state_up = 2;
|
|
float state_down = 3;
|
|
|
|
vector vec_origin = '0 0 0';
|
|
vector vec_hull_min = '-16 -16 -24';
|
|
vector vec_hull_max = '16 16 32';
|
|
|
|
vector vec_hull2_min = '-32 -32 -24';
|
|
vector vec_hull2_max = '32 32 64';
|
|
|
|
// protocol bytes
|
|
float svc_tempentity = 23;
|
|
float svc_killedmonster = 27;
|
|
float svc_foundsecret = 28;
|
|
float svc_intermission = 30;
|
|
float svc_finale = 31;
|
|
float svc_cdtrack = 32;
|
|
float svc_sellscreen = 33;
|
|
|
|
|
|
float te_spike = 0;
|
|
float te_superspike = 1;
|
|
float te_gunshot = 2;
|
|
float te_explosion = 3;
|
|
float te_tarexplosion = 4;
|
|
float te_lightning1 = 5;
|
|
float te_lightning2 = 6;
|
|
float te_wizspike = 7;
|
|
float te_knightspike = 8;
|
|
float te_lightning3 = 9;
|
|
float te_lavasplash = 10;
|
|
float te_teleport = 11;
|
|
|
|
// sound channels
|
|
// channel 0 never willingly overrides
|
|
// other channels (1-7) allways override a playing sound on that channel
|
|
float chan_auto = 0;
|
|
float chan_weapon = 1;
|
|
float chan_voice = 2;
|
|
float chan_item = 3;
|
|
float chan_body = 4;
|
|
|
|
float attn_none = 0;
|
|
float attn_norm = 1;
|
|
float attn_idle = 2;
|
|
float attn_static = 3;
|
|
|
|
// update types
|
|
|
|
float update_general = 0;
|
|
float update_static = 1;
|
|
float update_binary = 2;
|
|
float update_temp = 3;
|
|
|
|
// entity effects
|
|
|
|
float ef_brightfield = 1;
|
|
float ef_muzzleflash = 2;
|
|
float ef_brightlight = 4;
|
|
float ef_dimlight = 8;
|
|
|
|
|
|
// messages
|
|
float msg_broadcast = 0; // unreliable to all
|
|
float msg_one = 1; // reliable to one (msg_entity)
|
|
float msg_all = 2; // reliable to all
|
|
float msg_init = 3; // write to the init string
|
|
|
|
//================================================
|
|
|
|
//
|
|
// globals
|
|
//
|
|
float movedist;
|
|
float gameover; // set when a rule exits
|
|
|
|
string string_null; // null string, nothing should be held here
|
|
float empty_float;
|
|
|
|
entity newmis; // launch_spike sets this after spawning it
|
|
|
|
entity activator; // the entity that activated a trigger or brush
|
|
|
|
entity damage_attacker; // set by t_damage
|
|
float framecount;
|
|
|
|
float skill;
|
|
|
|
//================================================
|
|
|
|
//
|
|
// world fields (fixme: make globals)
|
|
//
|
|
.string wad;
|
|
.string map;
|
|
.float worldtype; // 0=medieval 1=metal 2=base
|
|
|
|
//================================================
|
|
|
|
.string killtarget;
|
|
|
|
//
|
|
// quakeed fields
|
|
//
|
|
.float light_lev; // not used by game, but parsed by light util
|
|
.float style;
|
|
|
|
|
|
//
|
|
// monster ai
|
|
//
|
|
.void() th_stand;
|
|
.void() th_walk;
|
|
.void() th_run;
|
|
.void() th_missile;
|
|
.void() th_melee;
|
|
.void(entity attacker, float damage) th_pain;
|
|
.void() th_die;
|
|
|
|
.entity oldenemy; // mad at this player before taking damage
|
|
|
|
.float speed;
|
|
|
|
.float lefty;
|
|
|
|
.float search_time;
|
|
.float attack_state;
|
|
|
|
float as_straight = 1;
|
|
float as_sliding = 2;
|
|
float as_melee = 3;
|
|
float as_missile = 4;
|
|
|
|
//
|
|
// player only fields
|
|
//
|
|
.float walkframe;
|
|
|
|
.float attack_finished;
|
|
.float pain_finished;
|
|
|
|
.float invincible_finished;
|
|
.float invisible_finished;
|
|
.float super_damage_finished;
|
|
.float radsuit_finished;
|
|
|
|
.float invincible_time, invincible_sound;
|
|
.float invisible_time, invisible_sound;
|
|
.float super_time, super_sound;
|
|
.float rad_time;
|
|
.float fly_sound;
|
|
|
|
.float axhitme;
|
|
|
|
.float show_hostile; // set to time+0.2 whenever a client fires a
|
|
// weapon or takes damage. used to alert
|
|
// monsters that otherwise would let the player go
|
|
.float jump_flag; // player jump flag
|
|
.float swim_flag; // player swimming sound flag
|
|
.float air_finished; // when time > air_finished, start drowning
|
|
.float bubble_count; // keeps track of the number of bubbles
|
|
.string deathtype; // keeps track of how the player died
|
|
|
|
//
|
|
// object stuff
|
|
//
|
|
.string mdl;
|
|
.vector mangle; // angle at start
|
|
|
|
.vector oldorigin; // only used by secret door
|
|
|
|
.float t_length, t_width;
|
|
|
|
|
|
//
|
|
// doors, etc
|
|
//
|
|
.vector dest, dest1, dest2;
|
|
.float wait; // time from firing to restarting
|
|
.float delay; // time from activation to firing
|
|
.entity trigger_field; // door's trigger entity
|
|
.string noise4;
|
|
|
|
//
|
|
// monsters
|
|
//
|
|
.float pausetime;
|
|
.entity movetarget;
|
|
|
|
|
|
//
|
|
// doors
|
|
//
|
|
.float aflag;
|
|
.float dmg; // damage done by door when hit
|
|
|
|
//
|
|
// misc
|
|
//
|
|
.float cnt; // misc flag
|
|
|
|
//
|
|
// subs
|
|
//
|
|
.void() think1;
|
|
.vector finaldest, finalangle;
|
|
|
|
//
|
|
// triggers
|
|
//
|
|
.float count; // for counting triggers
|
|
|
|
|
|
//
|
|
// plats / doors / buttons
|
|
//
|
|
.float lip;
|
|
.float state;
|
|
.vector pos1, pos2; // top and bottom positions
|
|
.float height;
|
|
|
|
//
|
|
// sounds
|
|
//
|
|
.float waitmin, waitmax;
|
|
.float distance;
|
|
.float volume;
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
|
|
//
|
|
// builtin functions
|
|
//
|
|
|
|
void(vector ang) makevectors = #1; // sets v_forward, etc globals
|
|
void(entity e, vector o) setorigin = #2;
|
|
void(entity e, string m) setmodel = #3; // set movetype and solid first
|
|
void(entity e, vector min, vector max) setsize = #4;
|
|
// #5 was removed
|
|
void() break = #6;
|
|
float() random = #7; // returns 0 - 1
|
|
void(entity e, float chan, string samp, float vol, float atten) 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;
|
|
|
|
// sets trace_* globals
|
|
// nomonsters can be:
|
|
// an entity will also be ignored for testing if forent == test,
|
|
// forent->owner == test, or test->owner == forent
|
|
// a forent of world is ignored
|
|
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
|
|
|
|
entity() checkclient = #17; // returns a client to look for
|
|
entity(entity start, .string fld, string match) find = #18;
|
|
string(string s) precache_sound = #19;
|
|
string(string s) precache_model = #20;
|
|
void(entity client, string s)stuffcmd = #21;
|
|
entity(vector org, float rad) findradius = #22;
|
|
void(string s) bprint = #23;
|
|
void(entity client, string s) sprint = #24;
|
|
void(string s) dprint = #25;
|
|
string(float f) ftos = #26;
|
|
string(vector v) vtos = #27;
|
|
void() coredump = #28; // prints all edicts
|
|
void() traceon = #29; // turns statment trace on
|
|
void() traceoff = #30;
|
|
void(entity e) eprint = #31; // prints an entire edict
|
|
float(float yaw, float dist) walkmove = #32; // returns true or false
|
|
// #33 was removed
|
|
float(float yaw, float dist) droptofloor= #34; // true if landed on floor
|
|
void(float style, string value) lightstyle = #35;
|
|
float(float v) rint = #36; // round to nearest int
|
|
float(float v) floor = #37; // largest integer <= v
|
|
float(float v) ceil = #38; // smallest integer >= v
|
|
// #39 was removed
|
|
float(entity e) checkbottom = #40; // true if self is on ground
|
|
float(vector v) pointcontents = #41; // returns a content_*
|
|
// #42 was removed
|
|
float(float f) fabs = #43;
|
|
vector(entity e, float speed) aim = #44; // returns the shooting vector
|
|
float(string s) cvar = #45; // return cvar.value
|
|
void(string s) localcmd = #46; // put string into local que
|
|
entity(entity e) nextent = #47; // for looping through all ents
|
|
void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
|
|
void() changeyaw = #49; // turn towards self.ideal_yaw
|
|
// at self.yaw_speed
|
|
// #50 was removed
|
|
vector(vector v) vectoangles = #51;
|
|
|
|
//
|
|
// direct client message generation
|
|
//
|
|
void(float to, float f) writebyte = #52;
|
|
void(float to, float f) writechar = #53;
|
|
void(float to, float f) writeshort = #54;
|
|
void(float to, float f) writelong = #55;
|
|
void(float to, float f) writecoord = #56;
|
|
void(float to, float f) writeangle = #57;
|
|
void(float to, string s) writestring = #58;
|
|
void(float to, entity s) writeentity = #59;
|
|
|
|
//
|
|
// broadcast client message generation
|
|
//
|
|
|
|
// void(float f) bwritebyte = #59;
|
|
// void(float f) bwritechar = #60;
|
|
// void(float f) bwriteshort = #61;
|
|
// void(float f) bwritelong = #62;
|
|
// void(float f) bwritecoord = #63;
|
|
// void(float f) bwriteangle = #64;
|
|
// void(string s) bwritestring = #65;
|
|
// void(entity e) bwriteentity = #66;
|
|
|
|
void(float step) movetogoal = #67;
|
|
|
|
string(string s) precache_file = #68; // no effect except for -copy
|
|
void(entity e) makestatic = #69;
|
|
void(string s) changelevel = #70;
|
|
|
|
//#71 was removed
|
|
|
|
void(string var, string val) cvar_set = #72; // sets cvar.value
|
|
|
|
void(entity client, string s) centerprint = #73; // sprint, but in middle
|
|
|
|
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
|
|
|
|
string(string s) precache_model2 = #75; // registered version only
|
|
string(string s) precache_sound2 = #76; // registered version only
|
|
string(string s) precache_file2 = #77; // registered version only
|
|
|
|
void(entity e) setspawnparms = #78; // set parm1... to the
|
|
// values at level start
|
|
// for coop respawn
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
// subs.qc
|
|
//
|
|
void(vector tdest, float tspeed, void() func) sub_calcmove;
|
|
void(entity ent, vector tdest, float tspeed, void() func) sub_calcmoveent;
|
|
void(vector destangle, float tspeed, void() func) sub_calcanglemove;
|
|
void() sub_calcmovedone;
|
|
void() sub_calcanglemovedone;
|
|
void() sub_null;
|
|
void() sub_usetargets;
|
|
void() sub_remove;
|
|
|
|
//
|
|
// combat.qc
|
|
//
|
|
void(entity targ, entity inflictor, entity attacker, float damage) t_damage;
|
|
|
|
|
|
float (entity e, float healamount, float ignore) t_heal; // health function
|
|
|
|
float(entity targ, entity inflictor) candamage;
|