super-coop/source/defs.qc

795 lines
18 KiB
Plaintext

// defs.qc: global definitions
// system globals ------------------------------------------------------------|
#pragma noref 1
entity self;
entity other;
entity world;
float time;
float frametime;
/* 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
*/
float force_retouch;
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;
/* called when a client first connects to a server. sets parms so they can be
* saved off for restarts
*/
void() SetNewParms;
// call to set parms for self so they can be saved for a level transition
void() SetChangeParms;
void end_sys_globals; // flag for structure dumping
// system fields -------------------------------------------------------------|
.float modelindex; // model index in the precached list
.vector absmin, absmax; // origin + mins / maxs
.float ltime; // time for entity
.float movetype;
.float solid;
.vector origin;
.vector oldorigin; // only used by secret door
.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;
// Will be world if not currently angry at anyone.
.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
// A yaw angle of the intended direction, which will be turned towards at up
// to 45 deg / state. If the enemy is in view and hunt_time is not active,
// this will be the exact line towards the enemy.
.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
// 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;
float() random = #7; // returns 0 - 1
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
vector(vector v) normalize = #9;
[[noreturn]] void(string e) error = #10;
[[noreturn]] 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
float() 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
float(entity e) checkbottom = #40; // true if self is on ground
float(vector v) pointcontents = #41; // returns a CONTENT_*
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 que
entity(entity e) nextent = #47; // for looping through all ents
// start a particle effect
void(vector o, vector d, float color, float count) particle = #48;
void() ChangeYaw = #49; // turn towards self.ideal_yaw at self.yaw_speed
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;
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;
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
// set parm1... to the values at level start for coop respawn
void(entity e) setspawnparms = #78;
// constants -----------------------------------------------------------------|
const vector VEC_ORIGIN = '0 0 0';
const vector VEC_HULL_MIN = '-16 -16 -24';
const vector VEC_HULL_MAX = '16 16 32';
const vector VEC_HULL2_MIN = '-32 -32 -24';
const vector VEC_HULL2_MAX = '32 32 64';
enum {
FALSE,
TRUE
};
// edict.flags
enum {
FL_FLY = 1,
FL_SWIM = 2,
FL_CLIENT = 8, // set for all client edicts
FL_INWATER = 16, // for enter / leave water splash
FL_MONSTER = 32,
FL_GODMODE = 64, // player cheat
FL_NOTARGET = 128, // player cheat
FL_ITEM = 256, // extra wide size for bonus items
FL_ONGROUND = 512, // standing on something
FL_PARTIALGROUND = 1024, // not all corners are valid
FL_WATERJUMP = 2048, // player jumping out of water
FL_JUMPRELEASED = 4096, // for jump debouncing
};
// edict.movetype values
enum {
MOVETYPE_NONE, // never moves
//MOVETYPE_ANGLENOCLIP,
//MOVETYPE_ANGLECLIP,
MOVETYPE_WALK = 3, // players only
MOVETYPE_STEP, // discrete, not real time unless fall
MOVETYPE_FLY,
MOVETYPE_TOSS, // gravity
MOVETYPE_PUSH, // no clip to world, push and crush
MOVETYPE_NOCLIP,
MOVETYPE_FLYMISSILE, // fly with extra size against monsters
MOVETYPE_BOUNCE,
MOVETYPE_BOUNCEMISSILE, // bounce with extra size
};
// edict.solid values
enum {
SOLID_NOT, // no interaction with other objects
SOLID_TRIGGER, // touch on edge, but not blocking
SOLID_BBOX, // touch on edge, block
SOLID_SLIDEBOX, // touch on edge, but not an onground
SOLID_BSP, // bsp clip, touch on edge, block
};
// range values
enum {
RANGE_MELEE,
RANGE_NEAR,
RANGE_MID,
RANGE_FAR,
};
// deadflag values
enum {
DEAD_NO,
DEAD_DYING,
DEAD_DEAD,
DEAD_RESPAWNABLE,
};
// takedamage values
enum {
DAMAGE_NO,
DAMAGE_YES,
DAMAGE_AIM,
};
// items
enum {
IT_SHOTGUN = 1,
IT_SUPER_SHOTGUN = 2,
IT_NAILGUN = 4,
IT_SUPER_NAILGUN = 8,
IT_GRENADE_LAUNCHER = 16,
IT_ROCKET_LAUNCHER = 32,
IT_LIGHTNING = 64,
IT_EXTRA_WEAPON = 128,
IT_AXE = 4096,
IT_SHELLS = 256,
IT_NAILS = 512,
IT_ROCKETS = 1024,
IT_CELLS = 2048,
IT_ARMOR1 = 8192,
IT_ARMOR2 = 16384,
IT_ARMOR3 = 32768,
IT_SUPERHEALTH = 65536,
IT_KEY1 = 131072,
IT_KEY2 = 262144,
IT_INVISIBILITY = 524288,
IT_INVULNERABILITY = 1048576,
IT_SUIT = 2097152,
IT_QUAD = 4194304,
};
// point content values
enum {
CONTENT_SKY = -6,
CONTENT_LAVA,
CONTENT_SLIME,
CONTENT_WATER,
CONTENT_SOLID,
CONTENT_EMPTY,
STATE_TOP,
STATE_BOTTOM,
STATE_UP,
STATE_DOWN,
};
// protocol bytes
enum {
SVC_TEMPENTITY = 23,
SVC_KILLEDMONSTER = 27,
SVC_FOUNDSECRET = 28,
SVC_INTERMISSION = 30,
SVC_FINALE = 31,
SVC_CDTRACK = 32,
SVC_SELLSCREEN = 33,
};
enum {
TE_SPIKE,
TE_SUPERSPIKE,
TE_GUNSHOT,
TE_EXPLOSION,
TE_TAREXPLOSION,
TE_LIGHTNING1,
TE_LIGHTNING2,
TE_WIZSPIKE,
TE_KNIGHTSPIKE,
TE_LIGHTNING3,
TE_LAVASPLASH,
TE_TELEPORT,
};
// sound channels
// channel 0 never willingly overrides
// other channels(1-7) allways override a playing sound on that channel
enum {
CHAN_AUTO,
CHAN_WEAPON,
CHAN_VOICE,
CHAN_ITEM,
CHAN_BODY,
};
enum {
ATTN_NONE,
ATTN_NORM,
ATTN_IDLE,
ATTN_STATIC,
};
// update types
enum {
UPDATE_GENERAL,
UPDATE_STATIC,
UPDATE_BINARY,
UPDATE_TEMP,
};
// entity effects
enum {
EF_BRIGHTFIELD = 1,
EF_MUZZLEFLASH = 2,
EF_BRIGHTLIGHT = 4,
EF_DIMLIGHT = 8,
};
// messages
enum {
MSG_BROADCAST, // unreliable to all
MSG_ONE, // reliable to one(msg_entity)
MSG_ALL, // reliable to all
MSG_INIT, // write to the init string
};
enum {
AS_STRAIGHT = 1,
AS_SLIDING,
AS_MELEE,
AS_MISSILE,
};
#pragma noref 0
// globals -------------------------------------------------------------------|
float movedist;
float gameover; // set when a rule exits
string string_null; // null string, nothing should be held here
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;
float enemy_vis, enemy_infront, enemy_range;
float enemy_yaw;
entity lastspawn;
entity multi_ent;
float multi_damage;
entity shub;
entity le1, le2;
float lightning_end;
float hknight_type;
entity bodyque_head;
float modelindex_eyes, modelindex_player;
float intermission_running;
float intermission_exittime;
string nextmap;
entity sight_entity;
float sight_entity_time;
// fields --------------------------------------------------------------------|
// world fields
.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;
// 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;
/* 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 show_hostile;
.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
.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;
// A monster will leave its stand state and head towards it's .movetarget when
// time > .pausetime.
.float pausetime;
// The next path spot to walk toward. If .enemy, ignore .movetarget.
// When an enemy is killed, the monster will try to return to it's path.
.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;
.float hit_z;
.float dmgtime;
.float inpain;
.float healamount, healtype;
// functions -----------------------------------------------------------------|
// subs.qc
void(float normal) SUB_AttackFinished;
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(void() thinkst) SUB_CheckRefire;
void() SUB_Null;
void(entity attacker, float damage) SUB_PainNull;
void() SUB_UseTargets;
void() SUB_Remove;
// combat.qc
float(entity e, float healamount, float ignore) T_Heal; // health function
float(entity targ, entity inflictor) CanDamage;
void() T_MissileTouch;
void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
// weapons.qc
void() W_FireAxe;
void() W_FireShotgun;
void() W_FireSuperShotgun;
void() W_FireRocket;
void() W_FireLightning;
void() W_FireGrenade;
void(float ox) W_FireSpikes;
void() W_FireSuperSpikes;
float() W_BestWeapon;
void() W_SetCurrentAmmo;
void() W_WeaponFrame;
void() army_fire;
float() DemonCheckAttack;
void() Demon_JumpTouch;
void(float side) Demon_Melee;
float() DogCheckAttack;
void() dog_leap1;
void() dog_run1;
void() ShalHome;
void() ShalMissile;
void() ShalMissileTouch;
float() crandom;
float(entity targ) infront;
float(entity targ) range;
float(entity targ) visible;
float(entity targ, entity attacker) SameTeam;
float(float v) anglemod;
void() DecodeLevelParms;
void(entity ent) CopyToBodyQue;
void() InitBodyQue;
void() SuperDamageSound;
void() ai_face;
void() armor_touch;
void() bubble_bob;
void() bubble_remove;
void() button_return;
void() button_wait;
void() door_go_down;
void() door_go_up;
void() fd_secret_done;
void() fd_secret_move1;
void() fd_secret_move2;
void() fd_secret_move3;
void() fd_secret_move4;
void() fd_secret_move5;
void() fd_secret_move6;
void() finale_1;
void() finale_2;
void() finale_3;
void() finale_4;
void() fire_fly;
void() fire_touch;
void() health_touch;
void() item_megahealth_rot;
void() make_bubbles;
void() monster_death_use;
void() movetarget_f;
void() powerup_touch;
void() set_suicide_frame;
void(vector org, vector dir) launch_spike;
void() spike_touch;
void() superspike_touch;
void() swimmonster_start;
void() t_movetarget;
void() train_next;
void(entity targ, entity attacker) ClientObituary;
void(float num_bubbles) DeathBubbles;
void(vector dest) ChooseTurn;
void(vector org, vector vec) LaunchLaser;
void(vector org, vector vel, float damage) SpawnBlood;
void() BecomeExplosion;
void() hknight_char_a1;
void() hknight_run1;
void() ogre_smash1;
void() ogre_swing1;
void() plat_center_touch;
void() plat_crush;
void() plat_go_down;
void() plat_go_up;
void() plat_outside_touch;
void() plat_trigger_use;
void() knight_atk1;
void() knight_bow1;
void() knight_bow6;
void() knight_runatk1;
void() knight_walk1;
void() PlayerDie;
void() player_axe1;
void() player_axeb1;
void() player_axec1;
void() player_axed1;
void() player_die_ax1;
void() player_diea1;
void() player_dieb1;
void() player_diec1;
void() player_died1;
void() player_diee1;
void() player_light1;
void() player_nail1;
void(entity attacker, float damage) player_pain;
void() player_rocket1;
void() player_run;
void() player_run;
void() player_shot1;
void() player_stand1;
void() sham_smash1;
void() sham_swingl1;
void() sham_swingr1;
void() sham_swingr1;
void() tbaby_jump1;
void() tbaby_jump5;
float() WizardCheckAttack;
void() wiz_run1;
void() wiz_side1;
void(vector org) spawn_tfog;
void(vector org, entity death_owner) spawn_tdeath;
void() info_player_start;
void() func_train_find;
void(vector p) boss_missile;
// EOF