r65 - trunk/basezym/progsqc
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Jun 28 23:29:44 EDT 2007
Author: vermeulen
Date: 2007-06-28 23:29:44 -0400 (Thu, 28 Jun 2007)
New Revision: 65
Added:
trunk/basezym/progsqc/jumppads.qc
Modified:
trunk/basezym/progsqc/actor.qc
trunk/basezym/progsqc/damage.qc
trunk/basezym/progsqc/decors.qc
trunk/basezym/progsqc/defs.qc
trunk/basezym/progsqc/dpextensions.qc
trunk/basezym/progsqc/gamedefs.qc
trunk/basezym/progsqc/inventory.qc
trunk/basezym/progsqc/mapentities.qc
trunk/basezym/progsqc/player.qc
trunk/basezym/progsqc/progs.src
trunk/basezym/progsqc/util.qc
Log:
Weapons are now completely customized by the config. Jetpack is updated to have a bit of acceleration, and player movement was changed to make air control a bit easier.
Basic jumppads also added, although not working
Modified: trunk/basezym/progsqc/actor.qc
===================================================================
--- trunk/basezym/progsqc/actor.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/actor.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -163,7 +163,7 @@
//s1 = ftos(self.button0);
//s2 = ftos(self.button3);
//s3 = ftos(self.weaponstate);
- //centerprint6(self, "actor_update ", s1, " ", s2, " ", s3);
+ //centerprint(self, "actor_update ", s1, " ", s2, " ", s3);
player_selectlegsanim(FALSE);
anim_update(self);
anim_update(self.actorpart_torso);
@@ -365,6 +365,9 @@
local float shotdamagetype;
local float shotlifetime;
local float shotprojectileflags;
+ local float numberof;
+ local float recoil;
+ local float mintofire;
local string shotmodel;
local string shotfiresound;
local string shotexplodesound;
@@ -375,7 +378,7 @@
if (secondary)
{
shotorg = muzzle2tagorigin; // overridden on hagar
- shotdir = v_forward * iteminfo_ammo2speeds_x + v_up * iteminfo_ammo2speeds_y + randomvec() * iteminfo_ammo2speeds_z;
+ shotdir = iteminfo_ammo2speeds;
shotdamage = iteminfo_ammo2damage;
shotdamagetype = iteminfo_ammo2damagetype;
shotlifetime = iteminfo_ammo2lifetime;
@@ -384,11 +387,14 @@
shotfiresound = iteminfo_ammo2firesound;
shotexplodesound = iteminfo_ammo2explodesound;
shotbouncesound = iteminfo_ammo2bouncesound;
+ numberof = iteminfo_ammo2numberof;
+ recoil = iteminfo_ammo2recoil;
+ mintofire = iteminfo_ammo2minimumtofire;
}
else
{
shotorg = muzzle1tagorigin;
- shotdir = v_forward * iteminfo_ammo1speeds_x + v_up * iteminfo_ammo1speeds_y + randomvec() * iteminfo_ammo1speeds_z;
+ shotdir = iteminfo_ammo1speeds;
shotdamage = iteminfo_ammo1damage;
shotdamagetype = iteminfo_ammo1damagetype;
shotlifetime = iteminfo_ammo1lifetime;
@@ -397,104 +403,20 @@
shotfiresound = iteminfo_ammo1firesound;
shotexplodesound = iteminfo_ammo1explodesound;
shotbouncesound = iteminfo_ammo1bouncesound;
+ numberof = iteminfo_ammo1numberof;
+ recoil = iteminfo_ammo1recoil;
+ mintofire = iteminfo_ammo1minimumtofire;
}
- if (self.weaponitem == ITEMTYPE_ASSAULTRAILGUN)
+ Inventory_ModifyItem(self, self.weaponitem, 0, 0 - mintofire, 0);
+ weapon_recoil(recoil);
+ while (numberof != 0)
{
- if (secondary)
- {
- }
- else
- {
- //Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_recoil(0);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
+ weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
+ numberof = numberof - 1;
}
- else if (self.weaponitem == ITEMTYPE_CRYLINK)
- {
- if (secondary)
- {
-
- }
- else
- {
- //Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_recoil(1);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
- }
- else if (self.weaponitem == ITEMTYPE_HAGAR)
- {
- if (secondary)
- {
-
- }
- else
- {
- Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_recoil(3);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
- }
- else if (self.weaponitem == ITEMTYPE_MINIGUN)
- {
- if (secondary)
- {
-
- }
- else
- {
- Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_recoil(1);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
- }
- else if (self.weaponitem == ITEMTYPE_RPG)
- {
- if (secondary)
- {
-
- }
- else
- {
- Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_recoil(6);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
- }
- else if (self.weaponitem == ITEMTYPE_SNIPERRAILGUN)
- {
- if (secondary)
- {
- }
- else
- {
- weapon_recoil(1);
- Inventory_ModifyItem(self, self.weaponitem, 0, 0 - iteminfo_ammo1minimumtofire, 0);
- weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound);
- }
- }
};
- /*
-void(float weaponitemtype, float request) weapon_think =
-{
- if (weaponitemtype == ITEMTYPE_ASSAULTRAILGUN)
- return weapon_hub_assaultrailgun(request);
- if (weaponitemtype == ITEMTYPE_CRYLINK)
- return weapon_hub_crylink(request);
- if (weaponitemtype == ITEMTYPE_HAGAR)
- return weapon_hub_hagar(request);
- if (weaponitemtype == ITEMTYPE_MINIGUN)
- return weapon_hub_minigun(request);
- if (weaponitemtype == ITEMTYPE_RPG)
- return weapon_hub_rpg(request);
- if (weaponitemtype == ITEMTYPE_SNIPERRAILGUN)
- return weapon_hub_sniperrailgun(request);
- error("weapon_hub: unknown weaponitemtype\n");
-};
- */
// only called at spawn
void(entity character, float weaponitemtype) weapon_setup =
Modified: trunk/basezym/progsqc/damage.qc
===================================================================
--- trunk/basezym/progsqc/damage.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/damage.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -10,12 +10,12 @@
float DAMAGETYPE_UNKNOWN = 0;
float DAMAGETYPE_FALL = 1;
-float DAMAGETYPE_ASSAULTRAILGUN_BULLET = 1020;
-float DAMAGETYPE_CRYLINK_SHOT = 1040;
-float DAMAGETYPE_HAGAR_ROCKET = 1050;
-float DAMAGETYPE_MINIGUN_RAPID = 1060;
-float DAMAGETYPE_RPG_ROCKET = 1070;
-float DAMAGETYPE_SNIPERRAILGUN_BULLET = 1080;
+float DAMAGETYPE_WEAP1 = 2;
+float DAMAGETYPE_WEAP2 = 3;
+float DAMAGETYPE_WEAP3 = 4;
+float DAMAGETYPE_WEAP4 = 5;
+float DAMAGETYPE_WEAP5 = 6;
+float DAMAGETYPE_WEAP6 = 7;
void(entity targ, entity attacker, float damagetype, float gibbed) PrintObituary =
{
@@ -63,14 +63,14 @@
m1 = targ.netname;
m2 = " met a flat world";
}
- else if (damagetype == DAMAGETYPE_ASSAULTRAILGUN_BULLET)
+ else if (damagetype == DAMAGETYPE_WEAP1)
{
m1 = targ.netname;
m2 = " now sports a new hole from ";
m3 = attacker.netname;
m4 = "";
}
- else if (damagetype == DAMAGETYPE_CRYLINK_SHOT)
+ else if (damagetype == DAMAGETYPE_WEAP2)
{
if (gibbed)
{
@@ -128,65 +128,48 @@
}
}
}
- else if (damagetype == DAMAGETYPE_HAGAR_ROCKET)
+ else if (damagetype == DAMAGETYPE_WEAP3)
{
- if (gibbed)
+ if (r < 0.50)
{
m1 = targ.netname;
- m2 = " was blown apart by ";
+ m2 = " was riddled with bullets from ";
m3 = attacker.netname;
m4 = "";
}
- else
+ else if (r < 0.75)
{
m1 = targ.netname;
- m2 = " was pummeled by ";
+ m2 = " was redecorated by ";
m3 = attacker.netname;
m4 = "";
}
- }
- else if (damagetype == DAMAGETYPE_HAGAR_ROCKET)
- {
- if (gibbed)
- {
- m1 = targ.netname;
- m2 = " was blown apart by a volley from ";
- m3 = attacker.netname;
- m4 = "";
- }
else
{
m1 = targ.netname;
- m2 = " met a swarm of missiles from ";
+ m2 = " was schooled in the minigun by ";
m3 = attacker.netname;
m4 = "";
}
}
- else if (damagetype == DAMAGETYPE_MINIGUN_RAPID)
+ else if (damagetype == DAMAGETYPE_WEAP4)
{
- if (r < 0.50)
+ if (gibbed)
{
m1 = targ.netname;
- m2 = " was riddled with bullets from ";
+ m2 = " was blown apart by a volley from ";
m3 = attacker.netname;
m4 = "";
}
- else if (r < 0.75)
- {
- m1 = targ.netname;
- m2 = " was redecorated by ";
- m3 = attacker.netname;
- m4 = "";
- }
else
{
m1 = targ.netname;
- m2 = " was schooled in the minigun by ";
+ m2 = " met a swarm of missiles from ";
m3 = attacker.netname;
m4 = "";
}
}
- else if (damagetype == DAMAGETYPE_RPG_ROCKET)
+ else if (damagetype == DAMAGETYPE_WEAP5)
{
if (gibbed)
{
@@ -203,7 +186,7 @@
m4 = "";
}
}
- else if (damagetype == DAMAGETYPE_SNIPERRAILGUN_BULLET)
+ else if (damagetype == DAMAGETYPE_WEAP6)
{
m1 = targ.netname;
m2 = " was rendered absolutely dead by ";
@@ -482,29 +465,30 @@
void(string modelname, vector shotorg, vector shotvel, vector damage, float damagtype, float lifetime, float projectileflags, string firesound, string explodesound, string bouncesound) weapon_fireprojectile =
{
local float r; // templeofnoise
+
+ newmis = spawn();
+ newmis.classname = "projectile";
+ newmis.solid = SOLID_BBOX;
+ newmis.movetype = MOVETYPE_BOUNCE;
+ newmis.damagetype = damagtype;
+ newmis.damageinfo = damage;
+ shotvel = v_forward * shotvel_x + v_up * shotvel_y + shotvel_z * randomvec();
+ newmis.velocity = shotvel;
+ newmis.angles = vectoangles(shotvel);
+ newmis.th_die = projectile_die;
+ newmis.touch = projectile_touch;
+ newmis.think = projectile_think;
+ newmis.nextthink = time;
+ newmis.cnt = time + lifetime;
+ newmis.lefty = projectileflags;
+ newmis.noise = explodesound;
+ newmis.noise1 = bouncesound;
+ newmis.owner = self; // initially same as realowner, cleared on first bounce so that it can hit owner
+ newmis.realowner = self; // who owns this projectile
+ setorigin(newmis, shotorg);
+ setmodel(newmis, modelname);
+ setsize(newmis, '0 0 0', '0 0 0');
- newmis = spawn();
- newmis.classname = "projectile";
- newmis.solid = SOLID_BBOX;
- newmis.movetype = MOVETYPE_BOUNCE;
- newmis.damagetype = damagtype;
- newmis.damageinfo = damage;
- newmis.velocity = shotvel;
- newmis.angles = vectoangles(shotvel);
- newmis.th_die = projectile_die;
- newmis.touch = projectile_touch;
- newmis.think = projectile_think;
- newmis.nextthink = time;
- newmis.cnt = time + lifetime;
- newmis.lefty = projectileflags;
- newmis.noise = explodesound;
- newmis.noise1 = bouncesound;
- newmis.owner = self; // initially same as realowner, cleared on first bounce so that it can hit owner
- newmis.realowner = self; // who owns this projectile
- setorigin(newmis, shotorg);
- setmodel(newmis, modelname);
- setsize(newmis, '0 0 0', '0 0 0');
-
if (firesound == "weapons/minigun_bulletfire1.wav") // templeofnoise: not so elegant checking a "string", FIXME with weapon check.
{
if (self.weaponsound_cycle == 0)
Modified: trunk/basezym/progsqc/decors.qc
===================================================================
--- trunk/basezym/progsqc/decors.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/decors.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,31 +1,31 @@
-
-void() decor_disappear =
-{
- self.model = "";
- self.effects = 0;
- self.pflags = 0;
- if (self.classname == "decor")
- remove(self);
-};
-
-void(entity e, string modelname, vector decormins, vector decormaxs, float scatter) decor_spawn =
-{
- local vector v;
- if (!e)
- {
- e = spawn();
- e.classname = "decor";
- }
- e.takedamage = FALSE;
- e.solid = SOLID_TRIGGER;
- e.movetype = MOVETYPE_BOUNCE;
- setmodel(e, modelname);
- setsize(e, decormins, decormaxs);
- v = randompos(self.mins, self.maxs) + self.origin;
- setorigin(e, v);
- e.velocity = self.velocity + randomvec() * scatter;
- e.think = decor_disappear;
- e.nextthink = time + random() * 30 + 30;
-};
-
-
+
+void() decor_disappear =
+{
+ self.model = "";
+ self.effects = 0;
+ self.pflags = 0;
+ if (self.classname == "decor")
+ remove(self);
+};
+
+void(entity e, string modelname, vector decormins, vector decormaxs, float scatter) decor_spawn =
+{
+ local vector v;
+ if (!e)
+ {
+ e = spawn();
+ e.classname = "decor";
+ }
+ e.takedamage = FALSE;
+ e.solid = SOLID_TRIGGER;
+ e.movetype = MOVETYPE_BOUNCE;
+ setmodel(e, modelname);
+ setsize(e, decormins, decormaxs);
+ v = randompos(self.mins, self.maxs) + self.origin;
+ setorigin(e, v);
+ e.velocity = self.velocity + randomvec() * scatter;
+ e.think = decor_disappear;
+ e.nextthink = time + random() * 30 + 30;
+};
+
+
Modified: trunk/basezym/progsqc/defs.qc
===================================================================
--- trunk/basezym/progsqc/defs.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/defs.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,716 +1,716 @@
-
-/*
-==============================================================================
-
- 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;
-
-// 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; // alive
-float DEAD_DYING = 1; // dying
-float DEAD_DEAD = 2; // dead, waiting for buttons to be released
-float DEAD_RESPAWNABLE = 3; // dead, waiting for button to be pressed
-float DEAD_RESPAWNING = 4; // dead, waiting for buttons to be released
-
-// 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_WEAPON1 = 4096;
-float IT_WEAPON2 = 1;
-float IT_WEAPON3 = 2;
-float IT_WEAPON4 = 4;
-float IT_WEAPON5 = 8;
-float IT_WEAPON6 = 16;
-float IT_WEAPON7 = 32;
-float IT_WEAPON8 = 64;
-float IT_WEAPON9 = 128;
-float IT_WEAPON10 = 8388608;
-
-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;
-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;
-
-// see modecheck.qc for deathmatch and teamplay settings
-
-// 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;
-//float TE_EXPLOSION2 = 12; // mission pack #2 explosion
-// // takes a color range
-// // 2 bytes:
-// // first color
-// // # of colors in the range
-//float TE_BEAM = 13; // mission pack #2 thing
-// // like TE_LIGHTNING etc,
-// // but uses progs/beam.mdl
-
-// 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;
-
-// added for Dark Places
-float CHAN_SPEECH = 5;
-float CHAN_FOOT = 6;
-float CHAN_WEAPON2 = 7;
-
-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;
-.float() th_missile; // LordHavoc: changed from void() to float(), returns true if attacking
-.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;
-
-// .gravity field added in Quake 1.07 (Scourge of Armagon)
-.float gravity;
-
-.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
-.string deathtype; // keeps track of how the player died
-.float bodyhealth; // used by corpse code
-.float iscorpse; // used by corpse code
-
-.vector dest, dest1, dest2, dest3, dest4, dest5;
-
-
-.entity flame; // the flame burning this thing
-
-.float doobits; // set if this should do obit on death
-
-//.vector bodymins, bodymaxs, headmins, headmaxs;
-
-.vector rotate;
-.string group;
-
-// counts of how many keys this player/bot has
-.float keys_silver;
-.float keys_gold;
-
-.float havocattack;
-.float havocpickup;
-.float(entity player, entity item) pickupevalfunc; // returns rating for item considering player's condition (don't pick up health if it's not needed, etc)
-.float shoulddodge;
-.float dangerrating;
-
-// called whenever damage is done, if not supplied there is no visible effect.
-.void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) bleedfunc;
-
-//
-// 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
-.float cnt2; // another counter
-.float count2; // yet another count
-
-//
-// subs
-//
-.void() think1;
-
-//
-// 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;
-
-
-
-
-//===========================================================================
-
-
-//
-// 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; // DarkPlaces note: can take multiple strings
-entity(vector org, float rad) findradius = #22;
-void(string s, ...) bprint = #23; // DarkPlaces note: can take multiple strings
-void(entity client, string s, ...) sprint = #24; // DarkPlaces note: can take multiple strings
-void(string s, ...) dprint = #25; // DarkPlaces note: can take multiple strings
-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() 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 // DarkPlaces note: can take multiple strings
-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; // DarkPlaces note: can take multiple strings
-
-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
-
+
+/*
+==============================================================================
+
+ 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;
+
+// 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; // alive
+float DEAD_DYING = 1; // dying
+float DEAD_DEAD = 2; // dead, waiting for buttons to be released
+float DEAD_RESPAWNABLE = 3; // dead, waiting for button to be pressed
+float DEAD_RESPAWNING = 4; // dead, waiting for buttons to be released
+
+// 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_WEAPON1 = 4096;
+float IT_WEAPON2 = 1;
+float IT_WEAPON3 = 2;
+float IT_WEAPON4 = 4;
+float IT_WEAPON5 = 8;
+float IT_WEAPON6 = 16;
+float IT_WEAPON7 = 32;
+float IT_WEAPON8 = 64;
+float IT_WEAPON9 = 128;
+float IT_WEAPON10 = 8388608;
+
+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;
+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;
+
+// see modecheck.qc for deathmatch and teamplay settings
+
+// 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;
+//float TE_EXPLOSION2 = 12; // mission pack #2 explosion
+// // takes a color range
+// // 2 bytes:
+// // first color
+// // # of colors in the range
+//float TE_BEAM = 13; // mission pack #2 thing
+// // like TE_LIGHTNING etc,
+// // but uses progs/beam.mdl
+
+// 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;
+
+// added for Dark Places
+float CHAN_SPEECH = 5;
+float CHAN_FOOT = 6;
+float CHAN_WEAPON2 = 7;
+
+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;
+.float() th_missile; // LordHavoc: changed from void() to float(), returns true if attacking
+.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;
+
+// .gravity field added in Quake 1.07 (Scourge of Armagon)
+.float gravity;
+
+.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
+.string deathtype; // keeps track of how the player died
+.float bodyhealth; // used by corpse code
+.float iscorpse; // used by corpse code
+
+.vector dest, dest1, dest2, dest3, dest4, dest5;
+
+
+.entity flame; // the flame burning this thing
+
+.float doobits; // set if this should do obit on death
+
+//.vector bodymins, bodymaxs, headmins, headmaxs;
+
+.vector rotate;
+.string group;
+
+// counts of how many keys this player/bot has
+.float keys_silver;
+.float keys_gold;
+
+.float havocattack;
+.float havocpickup;
+.float(entity player, entity item) pickupevalfunc; // returns rating for item considering player's condition (don't pick up health if it's not needed, etc)
+.float shoulddodge;
+.float dangerrating;
+
+// called whenever damage is done, if not supplied there is no visible effect.
+.void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) bleedfunc;
+
+//
+// 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
+.float cnt2; // another counter
+.float count2; // yet another count
+
+//
+// subs
+//
+.void() think1;
+
+//
+// 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;
+
+
+
+
+//===========================================================================
+
+
+//
+// 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; // DarkPlaces note: can take multiple strings
+entity(vector org, float rad) findradius = #22;
+void(string s, ...) bprint = #23; // DarkPlaces note: can take multiple strings
+void(entity client, string s, ...) sprint = #24; // DarkPlaces note: can take multiple strings
+void(string s, ...) dprint = #25; // DarkPlaces note: can take multiple strings
+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() 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 // DarkPlaces note: can take multiple strings
+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; // DarkPlaces note: can take multiple strings
+
+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
+
Modified: trunk/basezym/progsqc/dpextensions.qc
===================================================================
--- trunk/basezym/progsqc/dpextensions.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/dpextensions.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,1215 +1,1215 @@
-
-//DarkPlaces supported extension list, draft version 1.04
-
-//definitions that id Software left out
-//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed)
-float MOVE_NORMAL = 0; // same as FALSE
-float MOVE_NOMONSTERS = 1; // same as TRUE
-float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
-
-//checkextension function
-//idea: expected by almost everyone
-//darkplaces implementation: LordHavoc
-float(string s) checkextension = #99;
-//description:
-//check if (cvar("pr_checkextension")) before calling this, this is the only
-//guarenteed extension to be present in the extension system, it allows you
-//to check if an extension is available, by name, to check for an extension
-//use code like this:
-//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere)
-//if (cvar("pr_checkextension"))
-//if (checkextension("DP_SV_SETCOLOR"))
-// ext_setcolor = TRUE;
-//from then on you can check ext_setcolor to know if that extension is available
-
-//DP_BUTTONCHAT
-//idea: Vermeulen
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float buttonchat;
-//description:
-//true if the player is currently chatting (in messagemode, menus or console)
-
-//DP_BUTTONUSE
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float buttonuse;
-//client console commands:
-//+use
-//-use
-//description:
-//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes).
-
-// LordHavoc: HIGHLY experimental, do not implement this in other engines
-//DP_CGAME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//SVC definitions:
-float svc_cgame = 50; // [short] length [bytes] data
-//description:
-//contains network messages to client gamecode.
-
-//DP_CL_LOADSKY
-//idea: Nehahra, LordHavoc
-//darkplaces implementation: LordHavoc
-//client console commands:
-//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming)
-//description:
-//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX).
-
-//DP_CON_SET
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports the "set" console command which creates or sets a non-archived cvar (not saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
-
-//DP_CON_SETA
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports the "seta" console command which creates or sets an archived cvar (saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
-
-//DP_CON_ALIASPARAMETERS
-//idea: many
-//darkplaces implementation: Black
-//description:
-//indicates this engine supports aliases containing $1 through $9 parameter macros (which when called will expand to the parameters passed to the alias, for example alias test "say $2 $1", then you can type test hi there and it will execute say there hi), as well as $0 (name of the alias) and $* (all parameters $1 onward).
-
-//DP_CON_EXPANDCVAR
-//idea: many, PHP
-//darkplaces implementation: Black
-//description:
-//indicates this engine supports console commandlines containing $cvarname which will expand to the contents of that cvar as a parameter, for instance say my fov is $fov, will say "my fov is 90", or similar.
-
-//DP_CON_STARTMAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//adds two engine-called aliases named startmap_sp and startmap_dm which are called when the engine tries to start a singleplayer game from the menu (startmap_sp) or the -listen or -dedicated options are used or the engine is a dedicated server (uses startmap_dm), these allow a mod or game to specify their own map instead of start, and also distinguish between singleplayer and -listen/-dedicated, also these need not be a simple "map start" command, they can do other things if desired, startmap_sp and startmap_dm both default to "map start".
-
-//DP_EF_ADDITIVE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_ADDITIVE = 32;
-//description:
-//additive blending when this object is rendered
-
-//DP_EF_BLUE
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_BLUE = 64;
-//description:
-//entity emits blue light (used for quad)
-
-//DP_EF_FLAME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_FLAME = 1024;
-//description:
-//entity is on fire
-
-//DP_EF_FULLBRIGHT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_FULLBRIGHT = 512;
-//description:
-//entity is always brightly lit
-
-//DP_EF_NODEPTHTEST
-//idea: Supa
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_NODEPTHTEST = 8192;
-//description:
-//makes entity show up to client even through walls, useful with EF_ADDITIVE for special indicators like where team bases are in a map, so that people don't get lost
-
-//DP_EF_NODRAW
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_NODRAW = 16;
-//description:
-//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
-
-//DP_EF_NOSHADOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_NOSHADOW = 4096;
-//description:
-//realtime lights will not cast shadows from this entity (but can still illuminate it)
-
-//DP_EF_RED
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_RED = 128;
-//description:
-//entity emits red light (used for invulnerability)
-
-//DP_EF_STARDUST
-//idea: MythWorks Inc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_STARDUST = 2048;
-//description:
-//entity emits bouncing sparkles in every direction
-
-//DP_ENT_ALPHA
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//fields:
-.float alpha;
-//description:
-//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal).
-
-//DP_ENT_COLORMOD
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definition:
-.vector colormod;
-//description:
-//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal).
-
-//DP_ENT_CUSTOMCOLORMAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number.
-
-/*
-//NOTE: no longer supported by darkplaces because all entities are delta compressed now
-//DP_ENT_DELTACOMPRESS // no longer supported
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_DELTA = 8388608;
-//description:
-//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc).
-*/
-
-//DP_ENT_EXTERIORMODELTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//fields:
-.entity exteriormodeltoclient;
-//description:
-//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown. Also if tag attachments are supported any entities attached to the player entity will not be drawn in first person.
-
-//DP_ENT_GLOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float glow_color;
-.float glow_size;
-.float glow_trail;
-//description:
-//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light.
-
-//DP_ENT_LOWPRECISION
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_LOWPRECISION = 4194304;
-//description:
-//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc).
-
-//DP_ENT_SCALE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float scale;
-//description:
-//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
-
-//DP_ENT_VIEWMODEL
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity viewmodelforclient;
-//description:
-//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)... the entity is not visible to any other client.
-
-//DP_GFX_EXTERNALTEXTURES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//loads external textures found in various directories (tenebrae compatible)...
-/*
-in all examples .tga is merely the base texture, it can be any of these:
-.tga (base texture)
-_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha)
-_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend)
-_shirt.tga (same idea as pants, but for shirt color)
-_diffuse.tga (this may be used instead of base texture for per pixel lighting)
-_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale))
-_norm.tga (normalmap texture for per pixel lighting)
-_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility)
-_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility)
-
-due to glquake's incomplete Targa(r) loader, this section describes
-required Targa(r) features support:
-types:
-type 1 (uncompressed 8bit paletted with 24bit/32bit palette)
-type 2 (uncompressed 24bit/32bit true color, glquake supported this)
-type 3 (uncompressed 8bit greyscale)
-type 9 (RLE compressed 8bit paletted with 24bit/32bit palette)
-type 10 (RLE compressed 24bit/32bit true color, glquake supported this)
-type 11 (RLE compressed 8bit greyscale)
-attribute bit 0x20 (Origin At Top Left, top to bottom, left to right)
-
-image formats guarenteed to be supported: tga, pcx, lmp
-image formats that are optional: png, jpg
-
-mdl/spr/spr32 examples:
-skins are named _A (A being a number) and skingroups are named like _A_B
-these act as suffixes on the model name...
-example names for skin _2_1 of model "progs/armor.mdl":
-game/override/progs/armor.mdl_2_1.tga
-game/textures/progs/armor.mdl_2_1.tga
-game/progs/armor.mdl_2_1.tga
-example names for skin _0 of the model "progs/armor.mdl":
-game/override/progs/armor.mdl_0.tga
-game/textures/progs/armor.mdl_0.tga
-game/progs/armor.mdl_0.tga
-note that there can be more skins files (of the _0 naming) than the mdl
-contains, this is only useful to save space in the .mdl file if classic quake
-compatibility is not a concern.
-
-bsp/md2/md3 examples:
-example names for the texture "quake" of model "maps/start.bsp":
-game/override/quake.tga
-game/textures/quake.tga
-game/quake.tga
-
-sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad
-game/override/gfx/conchars.tga
-game/textures/gfx/conchars.tga
-game/gfx/conchars.tga
-*/
-
-//DP_GFX_FOG
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//worldspawn fields:
-//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3")
-//description:
-//global fog for the map, can not be changed by QC
-
-//DP_GFX_QUAKE3MODELTAGS
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity tag_entity; // entity this is attached to (call setattachment to set this)
-.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
-//builtin definitions:
-void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
-//description:
-//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
-//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
-//note 3: attaching to world turns off attachment
-//note 4: the entity that this is attached to must be visible for this to work
-//note 5: if an entity is attached to the player entity it will not be drawn in first person.
-
-//DP_GFX_SKINFILES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as:
-//progs/test.md3_0.skin
-//progs/test.md3_1.skin
-//...
-//
-//these files contain replace commands (replace meshname shadername), example:
-//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement
-//replace "teamstripes" "progs/test/redstripes.tga"
-//replace "visor" "common/nodraw" // this makes the visor mesh invisible
-////it is not possible to rename tags using this format
-//
-//Or the Quake3 syntax (100% compatible with Quake3's .skin files):
-//helmet,progs/test/helmet1.tga // this is a mesh shader replacement
-//teamstripes,progs/test/redstripes.tga
-//visor,common/nodraw // this makes the visor mesh invisible
-//tag_camera, // this defines that the first tag in the model is called tag_camera
-//tag_test, // this defines that the second tag in the model is called tag_test
-//
-//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible.
-//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set).
-//other commands might be added someday but it is not expected.
-
-//DP_GFX_SKYBOX
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//worldspawn fields:
-//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2)
-//description:
-//global skybox for the map, can not be changed by QC
-
-//DP_HALFLIFE_MAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30).
-
-//DP_HALFLIFE_MAP_CVAR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//cvars:
-//halflifebsp 0/1
-//description:
-//engine sets this cvar when loading a map to indicate if it is halflife format or not.
-
-//DP_HALFLIFE_SPRITE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//simply indicates that the engine supports HalfLife sprites.
-
-//DP_INPUTBUTTONS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float button3;
-.float button4;
-.float button5;
-.float button6;
-.float button7;
-.float button8;
-//description:
-//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
-
-//DP_LITSPRITES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports lighting on sprites, any sprite with ! in its filename (both on disk and in the qc) will be lit rather than having forced EF_FULLBRIGHT (EF_FULLBRIGHT on the entity can still force these sprites to not be lit).
-
-//DP_LITSUPPORT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine loads .lit files for any quake1 format .bsp files it loads to enhance maps with colored lighting.
-//implementation description: these files begin with the header QLIT followed by version number 1 (as little endian 32bit), the rest of the file is a replacement lightmaps lump, except being 3x as large as the lightmaps lump of the map it matches up with (and yes the between-lightmap padding is expanded 3x to keep this consistent), so the lightmap offset in each surface is simply multiplied by 3 during loading to properly index the lit data, and the lit file is loaded instead of the lightmap lump, other renderer changes are needed to display these of course... see the litsupport.zip sample code (almost a tutorial) at http://icculus.org/twilight/darkplaces for more information.
-
-//DP_MONSTERWALK
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player.
-
-//DP_MOVETYPEBOUNCEMISSILE
-//idea: id Software
-//darkplaces implementation: id Software
-//movetype definitions:
-//float MOVETYPE_BOUNCEMISSILE = 11; // already in defs.qc
-//description:
-//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts.
-
-//DP_MOVETYPEFOLLOW
-//idea: id Software, LordHavoc (redesigned)
-//darkplaces implementation: LordHavoc
-//movetype definitions:
-float MOVETYPE_FOLLOW = 12;
-//description:
-//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:
-//aiment - the entity this is attached to.
-//punchangle - the original angles when the follow began.
-//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
-//v_angle - the relative angles.
-//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:
-//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
-//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
-//hole.aiment = bmodel; // make the hole follow bmodel
-//hole.punchangle = bmodel.angles; // the original angles of bmodel
-//hole.view_ofs = hole.origin - bmodel.origin; // relative origin
-//hole.v_angle = hole.angles - bmodel.angles; // relative angles
-
-//DP_QC_CHANGEPITCH
-//idea: id Software
-//darkplaces implementation: id Software
-//field definitions:
-.float idealpitch;
-.float pitch_speed;
-//builtin definitions:
-void(entity ent) changepitch = #63;
-//description:
-//equivilant to changeyaw, ent is normally self. (this was a Q2 builtin)
-
-//DP_QC_COPYENTITY
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity from, entity to) copyentity = #400;
-//description:
-//copies all data in the entity to another entity.
-
-//DP_QC_CVAR_STRING
-//idea: VorteX
-//DarkPlaces implementation: VorteX, LordHavoc
-//builtin definitions:
-string(string s) cvar_string = #448;
-//description:
-//returns the value of a cvar, as a tempstring.
-
-//DP_QC_ETOS
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-string(entity ent) etos = #65;
-//description:
-//prints "entity 1" or similar into a string. (this was a Q2 builtin)
-
-//DP_QC_FINDCHAIN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.string fld, string match) findchain = #402;
-//description:
-//similar to find() but returns a chain of entities like findradius.
-
-//DP_QC_FINDCHAINFLAGS
-//idea: Sajt
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.float fld, float match) findchainflags = #450;
-//description:
-//similar to findflags() but returns a chain of entities like findradius.
-
-//DP_QC_FINDCHAINFLOAT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.entity fld, entity match) findchainentity = #403;
-entity(.float fld, float match) findchainfloat = #403;
-//description:
-//similar to findentity()/findfloat() but returns a chain of entities like findradius.
-
-//DP_QC_FINDFLAGS
-//idea: Sajt
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(entity start, .float fld, float match) findflags = #449;
-//description:
-//finds an entity with the specified flag set in the field, similar to find()
-
-//DP_QC_FINDFLOAT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(entity start, .entity fld, entity match) findentity = #98;
-entity(entity start, .float fld, float match) findfloat = #98;
-//description:
-//finds an entity or float field value, similar to find(), but for entity and float fields.
-
-//DP_QC_FS_SEARCH
-//idea: Black
-//darkplaces implementation: Black
-//builtin definitions:
-float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
-void(float handle) search_end = #445;
-float(float handle) search_getsize = #446;
-string(float handle, float num) search_getfilename = #447;
-//description:
-//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
-//search_end frees a search slot (also done at progs reload).
-//search_getsize returns how many filenames were found.
-//search_getfilename returns a filename from the search.
-
-//DP_QC_GETLIGHT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-vector(vector org) getlight = #92;
-//description:
-//returns the lighting at the requested location (in color), 0-255 range (can exceed 255).
-
-//DP_QC_GETSURFACE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(entity e, float s) getsurfacenumpoints = #434;
-vector(entity e, float s, float n) getsurfacepoint = #435;
-vector(entity e, float s) getsurfacenormal = #436;
-string(entity e, float s) getsurfacetexture = #437;
-float(entity e, vector p) getsurfacenearpoint = #438;
-vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
-//description:
-//functions to query surface information.
-
-//DP_QC_GETTAGINFO
-//idea: VorteX, LordHavoc (somebody else?)
-//DarkPlaces implementation: VorteX
-//builtin definitions:
-float(entity ent, string tagname) gettagindex = #451;
-vector(entity ent, float tagindex) gettaginfo = #452;
-//description:
-//gettagindex returns the number of a tag on an entity, this number is the same as set by setattachment (in the .tag_index field), allowing the qc to save a little cpu time by keeping the number around if it wishes (this could already be done by calling setattachment and saving off the tag_index).
-//gettaginfo returns the origin of the tag in worldspace and sets v_forward, v_right, and v_up to the current orientation of the tag in worldspace, this automatically resolves all dependencies (attachments, including viewmodelforclient), this means you could fire a shot from a tag on a gun entity attached to the view for example.
-
-//DP_QC_MINMAXBOUND
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(float a, float b) min = #94;
-float(float a, float b, float c) min3 = #94;
-float(float a, float b, float c, float d) min4 = #94;
-float(float a, float b, float c, float d, float e) min5 = #94;
-float(float a, float b, float c, float d, float e, float f) min6 = #94;
-float(float a, float b, float c, float d, float e, float f, float g) min7 = #94;
-float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
-float(float a, float b) max = #95;
-float(float a, float b, float c) max3 = #95;
-float(float a, float b, float c, float d) max4 = #95;
-float(float a, float b, float c, float d, float e) max5 = #95;
-float(float a, float b, float c, float d, float e, float f) max6 = #95;
-float(float a, float b, float c, float d, float e, float f, float g) max7 = #95;
-float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
-float(float minimum, float val, float maximum) bound = #96;
-//description:
-//min returns the lowest of all the supplied numbers.
-//max returns the highest of all the supplied numbers.
-//bound clamps the value to the range and returns it.
-
-//DP_QC_MULTIPLETEMPSTRINGS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//this extension makes all builtins returning tempstrings (ftos for example) cycle through a pool of multiple tempstrings (at least 16), allowing multiple ftos results to be gathered before putting them to use, normal quake only had 1 tempstring, causing many headaches. Note that for longer term storage (or compatibility on engines having FRIK_FILE but not this extension) the FRIK_FILE extension's strzone/strunzone builtins provide similar functionality (slower though).
-
-//DP_QC_RANDOMVEC
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-vector() randomvec = #91;
-//description:
-//returns a vector of length < 1, much quicker version of this QC: do {v_x = random()*2-1;v_y = random()*2-1;v_z = random()*2-1;} while(vlen(v) > 1)
-
-//DP_QC_SINCOSSQRTPOW
-//idea: id Software, LordHavoc
-//darkplaces implementation: id Software, LordHavoc
-//builtin definitions:
-float(float val) sin = #60;
-float(float val) cos = #61;
-float(float val) sqrt = #62;
-float(float a, float b) pow = #97;
-//description:
-//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively.
-
-//DP_QC_TRACEBOX
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
-//description:
-//similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).
-
-//DP_QC_TRACETOSS
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-void(entity ent, entity ignore) tracetoss = #64;
-//description:
-//simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc), returns relevant trace_ variables (trace_fraction is always 0, all other values are supported - trace_ent, trace_endpos, trace_plane_normal), does not actually alter the entity.
-
-//DP_QC_TRACE_MOVETYPE_HITMODEL
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float MOVE_HITMODEL = 4;
-//description:
-//allows traces to hit alias models (not sprites!) instead of entity boxes, use as the nomonsters parameter to trace functions, note that you can hit invisible model entities (alpha < 0 or EF_NODRAW or model "", it only checks modelindex)
-
-//DP_QC_TRACE_MOVETYPE_WORLDONLY
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float MOVE_WORLDONLY = 3;
-//description:
-//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
-
-//DP_QC_VECTORVECTORS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector dir) vectorvectors = #432;
-//description:
-//creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles.
-
-//DP_QUAKE2_MODEL
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake2 .md2 files.
-
-//DP_QUAKE2_SPRITE
-//idea: LordHavoc
-//darkplaces implementation: Elric
-//description:
-//shows that the engine supports Quake2 .sp2 files.
-
-//DP_QUAKE3_MAP
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake3 .bsp files.
-
-//DP_QUAKE3_MODEL
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake3 .md3 files.
-
-//DP_REGISTERCVAR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string name, string value) registercvar = #93;
-//description:
-//adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits.
-//NOTE: DP_CON_SET is much better.
-
-//DP_SND_DIRECTIONLESSATTNNONE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//make sounds with ATTN_NONE have no spatialization (enabling easy use as music sources).
-
-//DP_SND_FAKETRACKS
-//idea: requested
-//darkplaces implementation: Elric
-//description:
-//the engine plays sound/cdtracks/track001.wav instead of cd track 1 and so on if found, this allows games and mods to have music tracks without using ambientsound.
-//Note: also plays .ogg with DP_SND_OGGVORBIS extension.
-
-//DP_SND_OGGVORBIS
-//idea: Transfusion
-//darkplaces implementation: Elric
-//description:
-//the engine supports loading Ogg Vorbis sound files. Use either the .ogg filename directly, or a .wav of the same name (will try to load the .wav first and then .ogg).
-
-//DP_SND_STEREOWAV
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//the engine supports stereo WAV files. (useful with DP_SND_DIRECTIONLESSATTNNONE for music)
-
-//DP_SOLIDCORPSE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//solid definitions:
-float SOLID_CORPSE = 5;
-//description:
-//the entity will not collide with SOLID_CORPSE and SOLID_SLIDEBOX entities (and likewise they will not collide with it), this is useful if you want dead bodies that are shootable but do not obstruct movement by players and monsters, note that if you traceline with a SOLID_SLIDEBOX entity as the ignoreent, it will ignore SOLID_CORPSE entities, this is desirable for visibility and movement traces, but not for bullets, for the traceline to hit SOLID_CORPSE you must temporarily force the player (or whatever) to SOLID_BBOX and then restore to SOLID_SLIDEBOX after the traceline.
-
-//DP_SPRITE32
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//the engine supports .spr32 sprites.
-
-//DP_SV_BOTCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constants:
-float CLIENTTYPE_DISCONNECTED = 0;
-float CLIENTTYPE_REAL = 1;
-float CLIENTTYPE_BOT = 2;
-float CLIENTTYPE_NOTACLIENT = 3;
-//builtin definitions:
-entity() spawnclient = #454; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available
-float(entity clent) clienttype = #455; // returns one of the CLIENTTYPE_* constants
-//description:
-//spawns a client with no network connection, to allow bots to use client slots with no hacks.
-//How to use:
-/*
- // to spawn a bot
- local entity oldself;
- oldself = self;
- self = spawnclient();
- if (!self)
- {
- bprint("Can not add bot, server full.\n");
- self = oldself;
- return;
- }
- self.netname = "Yoyobot";
- self.clientcolors = 12 * 16 + 4; // yellow (12) shirt and red (4) pants
- ClientConnect();
- PutClientInServer();
- self = oldself;
-
- // to remove all bots
- local entity head;
- head = find(world, classname, "player");
- while (head)
- {
- if (clienttype(head) == CLIENTTYPE_BOT)
- dropclient(head);
- head = find(head, classname, "player");
- }
-
- // to identify if a client is a bot (for example in PlayerPreThink)
- if (clienttype(self) == CLIENTTYPE_BOT)
- botthink();
-*/
-//see also DP_SV_CLIENTCOLORS DP_SV_CLIENTNAME DP_SV_DROPCLIENT
-//How it works:
-//creates a new client, calls SetNewParms and stores the parms, and returns the client.
-//this intentionally does not call SV_SendServerinfo to allow the QuakeC a chance to set the netname and clientcolors fields before actually spawning the bot by calling ClientConnect and PutClientInServer manually
-//on level change ClientConnect and PutClientInServer are called by the engine to spawn in the bot (this is why clienttype() exists to tell you on the next level what type of client this is).
-//parms work the same on bot clients as they do on real clients, and do carry from level to level
-
-//DP_SV_CLIENTCOLORS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-.float clientcolors; // colors of the client (format: pants + shirt * 16)
-//description:
-//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed
-
-//DP_SV_CLIENTNAME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed
-
-//DP_SV_DRAWONLYTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity drawonlytoclient;
-//description:
-//the entity is only visible to the specified client.
-
-//DP_SV_DROPCLIENT
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity clent) dropclient = #453;
-//description:
-//causes the server to immediately drop the client, more reliable than stuffcmd(clent, "disconnect\n"); which could be intentionally ignored by the client engine
-
-//DP_SV_EFFECT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
-//SVC definitions:
-//float svc_effect = #52; // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
-//float svc_effect2 = #53; // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate
-//description:
-//clientside playback of simple custom sprite effects (explosion sprites, etc).
-
-//DP_SV_NODRAWTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity nodrawtoclient;
-//description:
-//the entity is not visible to the specified client.
-
-//DP_SV_PING
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float ping;
-//description:
-//continuously updated field indicating client's ping (based on average of last 16 packet time differences).
-
-//DP_SV_PUNCHVECTOR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.vector punchvector;
-//description:
-//offsets client view in worldspace, similar to view_ofs but all 3 components are used and are sent with at least 8 bits of fraction, this allows the view to be kicked around by damage or hard landings or whatever else, note that unlike punchangle this is not faded over time, it is up to the mod to fade it (see also DP_SV_PLAYERPHYSICS).
-
-//DP_SV_PLAYERPHYSICS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.vector movement;
-//cvar definitions:
-//"sv_playerphysicsqc" (0/1, default 1, allows user to disable qc player physics)
-//engine-called QC prototypes:
-//void() SV_PlayerPhysics;
-//description:
-//.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit)
-
-//DP_SV_PRECACHEANYTIME
-//idea: id Software (Quake2)
-//darkplaces implementation: LordHavoc
-//description:
-//this extension allows precache_model and precache_sound (and any variants) to be used during the game (with automatic messages to clients to precache the new model/sound indices), also setmodel/sound/ambientsound can be called without precaching first (they will cause an automatic precache).
-
-//DP_SV_ROTATINGBMODEL
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//this extension merely indicates that MOVETYPE_PUSH supports avelocity, allowing rotating brush models to be created, they rotate around their origin (needs rotation supporting qbsp/light utilities because id ones expected bmodel entity origins to be '0 0 0', recommend setting "origin" key in the entity fields in the map before compiling, there may be other methods depending on your qbsp, most are more complicated however).
-//tip: level designers can create a func_wall with an origin, and avelocity (for example "avelocity" "0 90 0"), and "nextthink" "99999999" to make a rotating bmodel without any qc modifications, such entities will be solid in stock quake but will not rotate)
-
-//DP_SV_SETCOLOR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity ent, float colors) setcolor = #401;
-//engine called QC functions (optional):
-//void(float color) SV_ChangeTeam;
-//description:
-//setcolor sets the color on a client and updates internal color information accordingly (equivilant to stuffing a "color" command but immediate)
-//SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this.
-//the color format is pants + shirt * 16 (0-255 potentially)
-
-//DP_SV_SLOWMO
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//cvars:
-//"slowmo" (0+, default 1)
-//description:
-//sets the time scale of the server, mainly intended for use in singleplayer by the player, however potentially useful for mods, so here's an extension for it.
-//range is 0 to infinite, recommended values to try are 0.1 (very slow, 10% speed), 1 (normal speed), 5 (500% speed).
-
-//DP_SV_WRITEUNTERMINATEDSTRING
-//idea: shadowalker
-//darkplaces implementation: Sajt
-//builtin definitions:
-void(float to, string s) WriteUnterminatedString = #456;
-//description:
-//like WriteString, but does not write a terminating 0 after the string. This means you can include things like a player's netname in the middle of a string sent over the network. Just be sure to end it up with either a call to WriteString (which includes the trailing 0) or WriteByte(0) to terminate it yourself.
-
-//DP_TE_BLOOD
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector velocity, float howmany) te_blood = #405;
-//temp entity definitions:
-float TE_BLOOD = 50;
-//protocol:
-//vector origin
-//byte xvelocity (-128 to +127)
-//byte yvelocity (-128 to +127)
-//byte zvelocity (-128 to +127)
-//byte count (0 to 255, how much blood)
-//description:
-//creates a blood effect.
-
-//DP_TE_BLOODSHOWER
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
-//temp entity definitions:
-//float TE_BLOODSHOWER = 52;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//coord explosionspeed (velocity of blood particles flying out of the center)
-//short count (number of blood particles)
-//description:
-//creates an exploding shower of blood, for making gibbings more convincing.
-
-//DP_TE_CUSTOMFLASH
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
-//temp entity definitions:
-//float TE_CUSTOMFLASH = 73;
-//protocol:
-//vector origin
-//byte radius ((MSG_ReadByte() + 1) * 8, meaning 8-2048 unit radius)
-//byte lifetime ((MSG_ReadByte() + 1) / 256.0, meaning approximately 0-1 second lifetime)
-//byte red (0.0 to 1.0 converted to 0-255)
-//byte green (0.0 to 1.0 converted to 0-255)
-//byte blue (0.0 to 1.0 converted to 0-255)
-//description:
-//creates a customized light flash.
-
-//DP_TE_EXPLOSIONRGB
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector color) te_explosionrgb = #407;
-//temp entity definitions:
-//float TE_EXPLOSIONRGB = 53;
-//protocol:
-//vector origin
-//byte red (0.0 to 1.0 converted to 0 to 255)
-//byte green (0.0 to 1.0 converted to 0 to 255)
-//byte blue (0.0 to 1.0 converted to 0 to 255)
-//description:
-//creates a colored explosion effect.
-
-//DP_TE_FLAMEJET
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector vel, float howmany) te_flamejet = #457;
-//temp entity definitions:
-//float TE_FLAMEJET = 74;
-//protocol:
-//vector origin
-//vector velocity
-//byte count (0 to 255, how many flame particles)
-//description:
-//creates a single puff of flame particles. (not very useful really)
-
-//DP_TE_PARTICLECUBE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
-//temp entity definitions:
-//float TE_PARTICLECUBE = 54;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity
-//short count
-//byte color (palette color)
-//byte gravity (TRUE or FALSE, FIXME should this be a scaler instead?)
-//coord randomvel (how much to jitter the velocity)
-//description:
-//creates a cloud of particles, useful for forcefields but quite customizable.
-
-//DP_TE_PARTICLERAIN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
-//temp entity definitions:
-//float TE_PARTICLERAIN = 55;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity (velocity of particles)
-//short count (number of particles)
-//byte color (8bit palette color)
-//description:
-//creates a shower of rain, the rain will appear either at the top (if falling down) or bottom (if falling up) of the cube.
-
-//DP_TE_PARTICLESNOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
-//temp entity definitions:
-//float TE_PARTICLERAIN = 56;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity (velocity of particles)
-//short count (number of particles)
-//byte color (8bit palette color)
-//description:
-//creates a shower of snow, the snow will appear either at the top (if falling down) or bottom (if falling up) of the cube, low velocities are advisable for convincing snow.
-
-//DP_TE_PLASMABURN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_plasmaburn = #433;
-//temp entity definitions:
-//float TE_PLASMABURN = 75;
-//protocol:
-//vector origin
-//description:
-//creates a small light flash (radius 200, time 0.2) and marks the walls.
-
-//DP_TE_QUADEFFECTS1
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_gunshotquad = #412;
-void(vector org) te_spikequad = #413;
-void(vector org) te_superspikequad = #414;
-void(vector org) te_explosionquad = #415;
-//temp entity definitions:
-//float TE_GUNSHOTQUAD = 57; // [vector] origin
-//float TE_SPIKEQUAD = 58; // [vector] origin
-//float TE_SUPERSPIKEQUAD = 59; // [vector] origin
-//float TE_EXPLOSIONQUAD = 70; // [vector] origin
-//protocol:
-//vector origin
-//description:
-//all of these just take a location, and are equivilant in function (but not appearance :) to the original TE_GUNSHOT, etc.
-
-//DP_TE_SMALLFLASH
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_smallflash = #416;
-//temp entity definitions:
-//float TE_SMALLFLASH = 72;
-//protocol:
-//vector origin
-//description:
-//creates a small light flash (radius 200, time 0.2).
-
-//DP_TE_SPARK
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector vel, float howmany) te_spark = #411;
-//temp entity definitions:
-//float TE_SPARK = 51;
-//protocol:
-//vector origin
-//byte xvelocity (-128 to 127)
-//byte yvelocity (-128 to 127)
-//byte zvelocity (-128 to 127)
-//byte count (number of sparks)
-//description:
-//creates a shower of sparks and a smoke puff.
-
-//DP_TE_STANDARDEFFECTBUILTINS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_gunshot = #418;
-void(vector org) te_spike = #419;
-void(vector org) te_superspike = #420;
-void(vector org) te_explosion = #421;
-void(vector org) te_tarexplosion = #422;
-void(vector org) te_wizspike = #423;
-void(vector org) te_knightspike = #424;
-void(vector org) te_lavasplash = #425;
-void(vector org) te_teleport = #426;
-void(vector org, float color, float colorlength) te_explosion2 = #427;
-void(entity own, vector start, vector end) te_lightning1 = #428;
-void(entity own, vector start, vector end) te_lightning2 = #429;
-void(entity own, vector start, vector end) te_lightning3 = #430;
-void(entity own, vector start, vector end) te_beam = #431;
-//description:
-//to make life easier on mod coders.
-
-//DP_VIEWZOOM
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float viewzoom;
-//description:
-//scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such)
-
-//FRIK_FILE
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string s) stof = #81; // get numerical value from a string
-float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason
-void(float fhandle) fclose = #111; // closes a file
-string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring
-void(float fhandle, string s) fputs = #113; // writes a line of text to the end of the file
-float(string s) strlen = #114; // returns how many characters are in a string
-string(string s1, string s2, ...) strcat = #115; // concatenates two strings (for example "abc", "def" would return "abcdef") and returns as a tempstring
-string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring
-vector(string s) stov = #117; // returns vector value from a string
-string(string s) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
-void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
-//constants:
-float FILE_READ = 0;
-float FILE_APPEND = 1;
-float FILE_WRITE = 2;
-//cvars:
-//pr_zone_min_strings : default 64 (64k), min 64 (64k), max 8192 (8mb)
-//description:
-//provides text file access functions and string manipulation functions, note that you may want to set pr_zone_min_strings in the worldspawn function if 64k is not enough string zone space.
-
-//KRIMZON_SV_PARSECLIENTCOMMAND
-//idea: KrimZon
-//darkplaces implementation: KrimZon, LordHavoc
-//engine-called QC prototypes:
-//void(string s) SV_ParseClientCommand;
-//builtin definitions:
-void(entity e, string s) clientcommand = #440;
-float(string s) tokenize = #441;
-string(float n) argv = #442;
-//description:
-//provides QC the ability to completely control server interpretation of client commands ("say" and "color" for example, clientcommand is necessary for this and substring (FRIK_FILE) is useful) as well as adding new commands (tokenize, argv, and stof (FRIK_FILE) are useful for this)), whenever a clc_stringcmd is received the QC function is called, and it is up to the QC to decide what (if anything) to do with it
-
-//NEH_CMD_PLAY2
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports the "play2" console command (plays a sound without spatialization).
-
-//NEH_RESTOREGAME
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//engine-called QC prototypes:
-//void() RestoreGame;
-//description:
-//when a savegame is loaded, this function is called
-
-//NEXUIZ_PLAYERMODEL
-//idea: Nexuiz
-//darkplaces implementation: Black
-//console commands:
-//playermodel <name> - FIXME: EXAMPLE NEEDED
-//playerskin <name> - FIXME: EXAMPLE NEEDED
-//field definitions:
-.string playermodel; // name of player model sent by client
-.string playerskin; // name of player skin sent by client
-//description:
-//these client properties are used by Nexuiz.
-
-//NXQ_GFX_LETTERBOX
-//idea: nxQuake
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports the "r_letterbox" console variable, set to values in the range 0-100 this restricts the view vertically (and turns off sbar and crosshair), value is a 0-100 percentage of how much to constrict the view, <=0 = normal view height, 25 = 75% of normal view height, 50 = 50%, 75 = 25%, >=100 = no view
-
-//PRYDON_CLIENTCURSOR
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_SELECTABLE = 16384; // allows cursor to highlight entity (brighten)
-//field definitions:
-.float cursor_active; // true if cl_prydoncursor mode is on
-.vector cursor_screen; // screen position of cursor as -1 to +1 in _x and _y (_z unused)
-.vector cursor_trace_start; // position of camera
-.vector cursor_trace_endpos; // position of cursor in world (as traced from camera)
-.entity cursor_trace_ent; // entity the cursor is pointing at (server forces this to world if the entity is currently free at time of receipt)
-//cvar definitions:
-//cl_prydoncursor (0/1+, default 0, 1 and above use cursors named gfx/prydoncursor%03i.lmp - or .tga and such if DP_GFX_EXTERNALTEXTURES is implemented)
-//description:
-//shows that the engine supports the cl_prydoncursor cvar, this puts a clientside mouse pointer on the screen and feeds input to the server for the QuakeC to use as it sees fit.
-//the mouse pointer triggers button4 if cursor is at left edge of screen, button5 if at right edge of screen, button6 if at top edge of screen, button7 if at bottom edge of screen.
-//the clientside trace skips transparent entities (except those marked EF_SELECTABLE).
-//the selected entity highlights only if EF_SELECTABLE is set, a typical selection method would be doubling the brightness of the entity by some means (such as colormod[] *= 2).
-//intended to be used by Prydon Gate.
-
-//TENEBRAE_GFX_DLIGHTS
-//idea: Tenebrae
-//darkplaces implementation: LordHavoc
-//fields:
-.float light_lev; // radius (does not affect brightness), typical value 350
-.vector color; // color (does not affect radius), typical value '1 1 1' (bright white), can be up to '255 255 255' (nuclear blast)
-.float style; // light style (like normal light entities, flickering torches or switchable, etc)
-.float pflags; // flags (see PFLAGS_ constants)
-.vector angles; // orientation of the light
-.float skin; // cubemap filter number, can be 1-255 (0 is assumed to be none, and tenebrae only allows 16-255), this selects a projective light filter, a value of 1 loads cubemaps/1posx.tga and cubemaps/1negx.tga and posy, negy, posz, and negz, similar to skybox but some sides need to be rotated or flipped
-//constants:
-float PFLAGS_NOSHADOW = 1; // light does not cast shadows
-float PFLAGS_CORONA = 2; // light has a corona flare
-float PFLAGS_FULLDYNAMIC = 128; // light enable (without this set no light is produced!)
-//description:
-//more powerful dynamic light settings
-//warning: it is best not to use cubemaps on a light entity that has a model, as using a skin number that a model does not have will cause issues in glquake, and produce warnings in darkplaces (use developer 1 to see them)
-//changes compared to tenebrae (because they're too 'leet' for standards):
-//note: networking should send entities with PFLAGS_FULLDYNAMIC set even if they have no model (lights in general do not have a model, nor should they)
-//EF_FULLDYNAMIC effects flag replaced by PFLAGS_FULLDYNAMIC flag (EF_FULLDYNAMIC conflicts with EF_NODRAW)
-
-//TW_SV_STEPCONTROL
-//idea: Transfusion
-//darkplaces implementation: LordHavoc
-//cvars:
-//sv_jumpstep (0/1, default 1)
-//sv_stepheight (default 18)
-//description:
-//sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be.
-
+
+//DarkPlaces supported extension list, draft version 1.04
+
+//definitions that id Software left out
+//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed)
+float MOVE_NORMAL = 0; // same as FALSE
+float MOVE_NOMONSTERS = 1; // same as TRUE
+float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
+
+//checkextension function
+//idea: expected by almost everyone
+//darkplaces implementation: LordHavoc
+float(string s) checkextension = #99;
+//description:
+//check if (cvar("pr_checkextension")) before calling this, this is the only
+//guarenteed extension to be present in the extension system, it allows you
+//to check if an extension is available, by name, to check for an extension
+//use code like this:
+//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere)
+//if (cvar("pr_checkextension"))
+//if (checkextension("DP_SV_SETCOLOR"))
+// ext_setcolor = TRUE;
+//from then on you can check ext_setcolor to know if that extension is available
+
+//DP_BUTTONCHAT
+//idea: Vermeulen
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float buttonchat;
+//description:
+//true if the player is currently chatting (in messagemode, menus or console)
+
+//DP_BUTTONUSE
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float buttonuse;
+//client console commands:
+//+use
+//-use
+//description:
+//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes).
+
+// LordHavoc: HIGHLY experimental, do not implement this in other engines
+//DP_CGAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//SVC definitions:
+float svc_cgame = 50; // [short] length [bytes] data
+//description:
+//contains network messages to client gamecode.
+
+//DP_CL_LOADSKY
+//idea: Nehahra, LordHavoc
+//darkplaces implementation: LordHavoc
+//client console commands:
+//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming)
+//description:
+//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX).
+
+//DP_CON_SET
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports the "set" console command which creates or sets a non-archived cvar (not saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
+
+//DP_CON_SETA
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports the "seta" console command which creates or sets an archived cvar (saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
+
+//DP_CON_ALIASPARAMETERS
+//idea: many
+//darkplaces implementation: Black
+//description:
+//indicates this engine supports aliases containing $1 through $9 parameter macros (which when called will expand to the parameters passed to the alias, for example alias test "say $2 $1", then you can type test hi there and it will execute say there hi), as well as $0 (name of the alias) and $* (all parameters $1 onward).
+
+//DP_CON_EXPANDCVAR
+//idea: many, PHP
+//darkplaces implementation: Black
+//description:
+//indicates this engine supports console commandlines containing $cvarname which will expand to the contents of that cvar as a parameter, for instance say my fov is $fov, will say "my fov is 90", or similar.
+
+//DP_CON_STARTMAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//adds two engine-called aliases named startmap_sp and startmap_dm which are called when the engine tries to start a singleplayer game from the menu (startmap_sp) or the -listen or -dedicated options are used or the engine is a dedicated server (uses startmap_dm), these allow a mod or game to specify their own map instead of start, and also distinguish between singleplayer and -listen/-dedicated, also these need not be a simple "map start" command, they can do other things if desired, startmap_sp and startmap_dm both default to "map start".
+
+//DP_EF_ADDITIVE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_ADDITIVE = 32;
+//description:
+//additive blending when this object is rendered
+
+//DP_EF_BLUE
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_BLUE = 64;
+//description:
+//entity emits blue light (used for quad)
+
+//DP_EF_FLAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_FLAME = 1024;
+//description:
+//entity is on fire
+
+//DP_EF_FULLBRIGHT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_FULLBRIGHT = 512;
+//description:
+//entity is always brightly lit
+
+//DP_EF_NODEPTHTEST
+//idea: Supa
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_NODEPTHTEST = 8192;
+//description:
+//makes entity show up to client even through walls, useful with EF_ADDITIVE for special indicators like where team bases are in a map, so that people don't get lost
+
+//DP_EF_NODRAW
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_NODRAW = 16;
+//description:
+//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
+
+//DP_EF_NOSHADOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_NOSHADOW = 4096;
+//description:
+//realtime lights will not cast shadows from this entity (but can still illuminate it)
+
+//DP_EF_RED
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_RED = 128;
+//description:
+//entity emits red light (used for invulnerability)
+
+//DP_EF_STARDUST
+//idea: MythWorks Inc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_STARDUST = 2048;
+//description:
+//entity emits bouncing sparkles in every direction
+
+//DP_ENT_ALPHA
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//fields:
+.float alpha;
+//description:
+//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal).
+
+//DP_ENT_COLORMOD
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definition:
+.vector colormod;
+//description:
+//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal).
+
+//DP_ENT_CUSTOMCOLORMAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number.
+
+/*
+//NOTE: no longer supported by darkplaces because all entities are delta compressed now
+//DP_ENT_DELTACOMPRESS // no longer supported
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_DELTA = 8388608;
+//description:
+//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc).
+*/
+
+//DP_ENT_EXTERIORMODELTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//fields:
+.entity exteriormodeltoclient;
+//description:
+//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown. Also if tag attachments are supported any entities attached to the player entity will not be drawn in first person.
+
+//DP_ENT_GLOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float glow_color;
+.float glow_size;
+.float glow_trail;
+//description:
+//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light.
+
+//DP_ENT_LOWPRECISION
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_LOWPRECISION = 4194304;
+//description:
+//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc).
+
+//DP_ENT_SCALE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float scale;
+//description:
+//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
+
+//DP_ENT_VIEWMODEL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity viewmodelforclient;
+//description:
+//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)... the entity is not visible to any other client.
+
+//DP_GFX_EXTERNALTEXTURES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//loads external textures found in various directories (tenebrae compatible)...
+/*
+in all examples .tga is merely the base texture, it can be any of these:
+.tga (base texture)
+_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha)
+_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend)
+_shirt.tga (same idea as pants, but for shirt color)
+_diffuse.tga (this may be used instead of base texture for per pixel lighting)
+_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale))
+_norm.tga (normalmap texture for per pixel lighting)
+_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility)
+_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility)
+
+due to glquake's incomplete Targa(r) loader, this section describes
+required Targa(r) features support:
+types:
+type 1 (uncompressed 8bit paletted with 24bit/32bit palette)
+type 2 (uncompressed 24bit/32bit true color, glquake supported this)
+type 3 (uncompressed 8bit greyscale)
+type 9 (RLE compressed 8bit paletted with 24bit/32bit palette)
+type 10 (RLE compressed 24bit/32bit true color, glquake supported this)
+type 11 (RLE compressed 8bit greyscale)
+attribute bit 0x20 (Origin At Top Left, top to bottom, left to right)
+
+image formats guarenteed to be supported: tga, pcx, lmp
+image formats that are optional: png, jpg
+
+mdl/spr/spr32 examples:
+skins are named _A (A being a number) and skingroups are named like _A_B
+these act as suffixes on the model name...
+example names for skin _2_1 of model "progs/armor.mdl":
+game/override/progs/armor.mdl_2_1.tga
+game/textures/progs/armor.mdl_2_1.tga
+game/progs/armor.mdl_2_1.tga
+example names for skin _0 of the model "progs/armor.mdl":
+game/override/progs/armor.mdl_0.tga
+game/textures/progs/armor.mdl_0.tga
+game/progs/armor.mdl_0.tga
+note that there can be more skins files (of the _0 naming) than the mdl
+contains, this is only useful to save space in the .mdl file if classic quake
+compatibility is not a concern.
+
+bsp/md2/md3 examples:
+example names for the texture "quake" of model "maps/start.bsp":
+game/override/quake.tga
+game/textures/quake.tga
+game/quake.tga
+
+sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad
+game/override/gfx/conchars.tga
+game/textures/gfx/conchars.tga
+game/gfx/conchars.tga
+*/
+
+//DP_GFX_FOG
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//worldspawn fields:
+//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3")
+//description:
+//global fog for the map, can not be changed by QC
+
+//DP_GFX_QUAKE3MODELTAGS
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity tag_entity; // entity this is attached to (call setattachment to set this)
+.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
+//builtin definitions:
+void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
+//description:
+//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
+//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
+//note 3: attaching to world turns off attachment
+//note 4: the entity that this is attached to must be visible for this to work
+//note 5: if an entity is attached to the player entity it will not be drawn in first person.
+
+//DP_GFX_SKINFILES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as:
+//progs/test.md3_0.skin
+//progs/test.md3_1.skin
+//...
+//
+//these files contain replace commands (replace meshname shadername), example:
+//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement
+//replace "teamstripes" "progs/test/redstripes.tga"
+//replace "visor" "common/nodraw" // this makes the visor mesh invisible
+////it is not possible to rename tags using this format
+//
+//Or the Quake3 syntax (100% compatible with Quake3's .skin files):
+//helmet,progs/test/helmet1.tga // this is a mesh shader replacement
+//teamstripes,progs/test/redstripes.tga
+//visor,common/nodraw // this makes the visor mesh invisible
+//tag_camera, // this defines that the first tag in the model is called tag_camera
+//tag_test, // this defines that the second tag in the model is called tag_test
+//
+//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible.
+//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set).
+//other commands might be added someday but it is not expected.
+
+//DP_GFX_SKYBOX
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//worldspawn fields:
+//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2)
+//description:
+//global skybox for the map, can not be changed by QC
+
+//DP_HALFLIFE_MAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30).
+
+//DP_HALFLIFE_MAP_CVAR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//cvars:
+//halflifebsp 0/1
+//description:
+//engine sets this cvar when loading a map to indicate if it is halflife format or not.
+
+//DP_HALFLIFE_SPRITE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//simply indicates that the engine supports HalfLife sprites.
+
+//DP_INPUTBUTTONS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float button3;
+.float button4;
+.float button5;
+.float button6;
+.float button7;
+.float button8;
+//description:
+//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
+
+//DP_LITSPRITES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports lighting on sprites, any sprite with ! in its filename (both on disk and in the qc) will be lit rather than having forced EF_FULLBRIGHT (EF_FULLBRIGHT on the entity can still force these sprites to not be lit).
+
+//DP_LITSUPPORT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine loads .lit files for any quake1 format .bsp files it loads to enhance maps with colored lighting.
+//implementation description: these files begin with the header QLIT followed by version number 1 (as little endian 32bit), the rest of the file is a replacement lightmaps lump, except being 3x as large as the lightmaps lump of the map it matches up with (and yes the between-lightmap padding is expanded 3x to keep this consistent), so the lightmap offset in each surface is simply multiplied by 3 during loading to properly index the lit data, and the lit file is loaded instead of the lightmap lump, other renderer changes are needed to display these of course... see the litsupport.zip sample code (almost a tutorial) at http://icculus.org/twilight/darkplaces for more information.
+
+//DP_MONSTERWALK
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player.
+
+//DP_MOVETYPEBOUNCEMISSILE
+//idea: id Software
+//darkplaces implementation: id Software
+//movetype definitions:
+//float MOVETYPE_BOUNCEMISSILE = 11; // already in defs.qc
+//description:
+//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts.
+
+//DP_MOVETYPEFOLLOW
+//idea: id Software, LordHavoc (redesigned)
+//darkplaces implementation: LordHavoc
+//movetype definitions:
+float MOVETYPE_FOLLOW = 12;
+//description:
+//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:
+//aiment - the entity this is attached to.
+//punchangle - the original angles when the follow began.
+//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
+//v_angle - the relative angles.
+//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:
+//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
+//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
+//hole.aiment = bmodel; // make the hole follow bmodel
+//hole.punchangle = bmodel.angles; // the original angles of bmodel
+//hole.view_ofs = hole.origin - bmodel.origin; // relative origin
+//hole.v_angle = hole.angles - bmodel.angles; // relative angles
+
+//DP_QC_CHANGEPITCH
+//idea: id Software
+//darkplaces implementation: id Software
+//field definitions:
+.float idealpitch;
+.float pitch_speed;
+//builtin definitions:
+void(entity ent) changepitch = #63;
+//description:
+//equivilant to changeyaw, ent is normally self. (this was a Q2 builtin)
+
+//DP_QC_COPYENTITY
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity from, entity to) copyentity = #400;
+//description:
+//copies all data in the entity to another entity.
+
+//DP_QC_CVAR_STRING
+//idea: VorteX
+//DarkPlaces implementation: VorteX, LordHavoc
+//builtin definitions:
+string(string s) cvar_string = #448;
+//description:
+//returns the value of a cvar, as a tempstring.
+
+//DP_QC_ETOS
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+string(entity ent) etos = #65;
+//description:
+//prints "entity 1" or similar into a string. (this was a Q2 builtin)
+
+//DP_QC_FINDCHAIN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.string fld, string match) findchain = #402;
+//description:
+//similar to find() but returns a chain of entities like findradius.
+
+//DP_QC_FINDCHAINFLAGS
+//idea: Sajt
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.float fld, float match) findchainflags = #450;
+//description:
+//similar to findflags() but returns a chain of entities like findradius.
+
+//DP_QC_FINDCHAINFLOAT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.entity fld, entity match) findchainentity = #403;
+entity(.float fld, float match) findchainfloat = #403;
+//description:
+//similar to findentity()/findfloat() but returns a chain of entities like findradius.
+
+//DP_QC_FINDFLAGS
+//idea: Sajt
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(entity start, .float fld, float match) findflags = #449;
+//description:
+//finds an entity with the specified flag set in the field, similar to find()
+
+//DP_QC_FINDFLOAT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(entity start, .entity fld, entity match) findentity = #98;
+entity(entity start, .float fld, float match) findfloat = #98;
+//description:
+//finds an entity or float field value, similar to find(), but for entity and float fields.
+
+//DP_QC_FS_SEARCH
+//idea: Black
+//darkplaces implementation: Black
+//builtin definitions:
+float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
+void(float handle) search_end = #445;
+float(float handle) search_getsize = #446;
+string(float handle, float num) search_getfilename = #447;
+//description:
+//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
+//search_end frees a search slot (also done at progs reload).
+//search_getsize returns how many filenames were found.
+//search_getfilename returns a filename from the search.
+
+//DP_QC_GETLIGHT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector(vector org) getlight = #92;
+//description:
+//returns the lighting at the requested location (in color), 0-255 range (can exceed 255).
+
+//DP_QC_GETSURFACE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(entity e, float s) getsurfacenumpoints = #434;
+vector(entity e, float s, float n) getsurfacepoint = #435;
+vector(entity e, float s) getsurfacenormal = #436;
+string(entity e, float s) getsurfacetexture = #437;
+float(entity e, vector p) getsurfacenearpoint = #438;
+vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
+//description:
+//functions to query surface information.
+
+//DP_QC_GETTAGINFO
+//idea: VorteX, LordHavoc (somebody else?)
+//DarkPlaces implementation: VorteX
+//builtin definitions:
+float(entity ent, string tagname) gettagindex = #451;
+vector(entity ent, float tagindex) gettaginfo = #452;
+//description:
+//gettagindex returns the number of a tag on an entity, this number is the same as set by setattachment (in the .tag_index field), allowing the qc to save a little cpu time by keeping the number around if it wishes (this could already be done by calling setattachment and saving off the tag_index).
+//gettaginfo returns the origin of the tag in worldspace and sets v_forward, v_right, and v_up to the current orientation of the tag in worldspace, this automatically resolves all dependencies (attachments, including viewmodelforclient), this means you could fire a shot from a tag on a gun entity attached to the view for example.
+
+//DP_QC_MINMAXBOUND
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(float a, float b) min = #94;
+float(float a, float b, float c) min3 = #94;
+float(float a, float b, float c, float d) min4 = #94;
+float(float a, float b, float c, float d, float e) min5 = #94;
+float(float a, float b, float c, float d, float e, float f) min6 = #94;
+float(float a, float b, float c, float d, float e, float f, float g) min7 = #94;
+float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
+float(float a, float b) max = #95;
+float(float a, float b, float c) max3 = #95;
+float(float a, float b, float c, float d) max4 = #95;
+float(float a, float b, float c, float d, float e) max5 = #95;
+float(float a, float b, float c, float d, float e, float f) max6 = #95;
+float(float a, float b, float c, float d, float e, float f, float g) max7 = #95;
+float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
+float(float minimum, float val, float maximum) bound = #96;
+//description:
+//min returns the lowest of all the supplied numbers.
+//max returns the highest of all the supplied numbers.
+//bound clamps the value to the range and returns it.
+
+//DP_QC_MULTIPLETEMPSTRINGS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//this extension makes all builtins returning tempstrings (ftos for example) cycle through a pool of multiple tempstrings (at least 16), allowing multiple ftos results to be gathered before putting them to use, normal quake only had 1 tempstring, causing many headaches. Note that for longer term storage (or compatibility on engines having FRIK_FILE but not this extension) the FRIK_FILE extension's strzone/strunzone builtins provide similar functionality (slower though).
+
+//DP_QC_RANDOMVEC
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector() randomvec = #91;
+//description:
+//returns a vector of length < 1, much quicker version of this QC: do {v_x = random()*2-1;v_y = random()*2-1;v_z = random()*2-1;} while(vlen(v) > 1)
+
+//DP_QC_SINCOSSQRTPOW
+//idea: id Software, LordHavoc
+//darkplaces implementation: id Software, LordHavoc
+//builtin definitions:
+float(float val) sin = #60;
+float(float val) cos = #61;
+float(float val) sqrt = #62;
+float(float a, float b) pow = #97;
+//description:
+//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively.
+
+//DP_QC_TRACEBOX
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
+//description:
+//similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).
+
+//DP_QC_TRACETOSS
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+void(entity ent, entity ignore) tracetoss = #64;
+//description:
+//simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc), returns relevant trace_ variables (trace_fraction is always 0, all other values are supported - trace_ent, trace_endpos, trace_plane_normal), does not actually alter the entity.
+
+//DP_QC_TRACE_MOVETYPE_HITMODEL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float MOVE_HITMODEL = 4;
+//description:
+//allows traces to hit alias models (not sprites!) instead of entity boxes, use as the nomonsters parameter to trace functions, note that you can hit invisible model entities (alpha < 0 or EF_NODRAW or model "", it only checks modelindex)
+
+//DP_QC_TRACE_MOVETYPE_WORLDONLY
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float MOVE_WORLDONLY = 3;
+//description:
+//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
+
+//DP_QC_VECTORVECTORS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector dir) vectorvectors = #432;
+//description:
+//creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles.
+
+//DP_QUAKE2_MODEL
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake2 .md2 files.
+
+//DP_QUAKE2_SPRITE
+//idea: LordHavoc
+//darkplaces implementation: Elric
+//description:
+//shows that the engine supports Quake2 .sp2 files.
+
+//DP_QUAKE3_MAP
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake3 .bsp files.
+
+//DP_QUAKE3_MODEL
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake3 .md3 files.
+
+//DP_REGISTERCVAR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(string name, string value) registercvar = #93;
+//description:
+//adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits.
+//NOTE: DP_CON_SET is much better.
+
+//DP_SND_DIRECTIONLESSATTNNONE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//make sounds with ATTN_NONE have no spatialization (enabling easy use as music sources).
+
+//DP_SND_FAKETRACKS
+//idea: requested
+//darkplaces implementation: Elric
+//description:
+//the engine plays sound/cdtracks/track001.wav instead of cd track 1 and so on if found, this allows games and mods to have music tracks without using ambientsound.
+//Note: also plays .ogg with DP_SND_OGGVORBIS extension.
+
+//DP_SND_OGGVORBIS
+//idea: Transfusion
+//darkplaces implementation: Elric
+//description:
+//the engine supports loading Ogg Vorbis sound files. Use either the .ogg filename directly, or a .wav of the same name (will try to load the .wav first and then .ogg).
+
+//DP_SND_STEREOWAV
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//the engine supports stereo WAV files. (useful with DP_SND_DIRECTIONLESSATTNNONE for music)
+
+//DP_SOLIDCORPSE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//solid definitions:
+float SOLID_CORPSE = 5;
+//description:
+//the entity will not collide with SOLID_CORPSE and SOLID_SLIDEBOX entities (and likewise they will not collide with it), this is useful if you want dead bodies that are shootable but do not obstruct movement by players and monsters, note that if you traceline with a SOLID_SLIDEBOX entity as the ignoreent, it will ignore SOLID_CORPSE entities, this is desirable for visibility and movement traces, but not for bullets, for the traceline to hit SOLID_CORPSE you must temporarily force the player (or whatever) to SOLID_BBOX and then restore to SOLID_SLIDEBOX after the traceline.
+
+//DP_SPRITE32
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//the engine supports .spr32 sprites.
+
+//DP_SV_BOTCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constants:
+float CLIENTTYPE_DISCONNECTED = 0;
+float CLIENTTYPE_REAL = 1;
+float CLIENTTYPE_BOT = 2;
+float CLIENTTYPE_NOTACLIENT = 3;
+//builtin definitions:
+entity() spawnclient = #454; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available
+float(entity clent) clienttype = #455; // returns one of the CLIENTTYPE_* constants
+//description:
+//spawns a client with no network connection, to allow bots to use client slots with no hacks.
+//How to use:
+/*
+ // to spawn a bot
+ local entity oldself;
+ oldself = self;
+ self = spawnclient();
+ if (!self)
+ {
+ bprint("Can not add bot, server full.\n");
+ self = oldself;
+ return;
+ }
+ self.netname = "Yoyobot";
+ self.clientcolors = 12 * 16 + 4; // yellow (12) shirt and red (4) pants
+ ClientConnect();
+ PutClientInServer();
+ self = oldself;
+
+ // to remove all bots
+ local entity head;
+ head = find(world, classname, "player");
+ while (head)
+ {
+ if (clienttype(head) == CLIENTTYPE_BOT)
+ dropclient(head);
+ head = find(head, classname, "player");
+ }
+
+ // to identify if a client is a bot (for example in PlayerPreThink)
+ if (clienttype(self) == CLIENTTYPE_BOT)
+ botthink();
+*/
+//see also DP_SV_CLIENTCOLORS DP_SV_CLIENTNAME DP_SV_DROPCLIENT
+//How it works:
+//creates a new client, calls SetNewParms and stores the parms, and returns the client.
+//this intentionally does not call SV_SendServerinfo to allow the QuakeC a chance to set the netname and clientcolors fields before actually spawning the bot by calling ClientConnect and PutClientInServer manually
+//on level change ClientConnect and PutClientInServer are called by the engine to spawn in the bot (this is why clienttype() exists to tell you on the next level what type of client this is).
+//parms work the same on bot clients as they do on real clients, and do carry from level to level
+
+//DP_SV_CLIENTCOLORS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+.float clientcolors; // colors of the client (format: pants + shirt * 16)
+//description:
+//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed
+
+//DP_SV_CLIENTNAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed
+
+//DP_SV_DRAWONLYTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity drawonlytoclient;
+//description:
+//the entity is only visible to the specified client.
+
+//DP_SV_DROPCLIENT
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity clent) dropclient = #453;
+//description:
+//causes the server to immediately drop the client, more reliable than stuffcmd(clent, "disconnect\n"); which could be intentionally ignored by the client engine
+
+//DP_SV_EFFECT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
+//SVC definitions:
+//float svc_effect = #52; // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
+//float svc_effect2 = #53; // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate
+//description:
+//clientside playback of simple custom sprite effects (explosion sprites, etc).
+
+//DP_SV_NODRAWTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity nodrawtoclient;
+//description:
+//the entity is not visible to the specified client.
+
+//DP_SV_PING
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float ping;
+//description:
+//continuously updated field indicating client's ping (based on average of last 16 packet time differences).
+
+//DP_SV_PUNCHVECTOR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.vector punchvector;
+//description:
+//offsets client view in worldspace, similar to view_ofs but all 3 components are used and are sent with at least 8 bits of fraction, this allows the view to be kicked around by damage or hard landings or whatever else, note that unlike punchangle this is not faded over time, it is up to the mod to fade it (see also DP_SV_PLAYERPHYSICS).
+
+//DP_SV_PLAYERPHYSICS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.vector movement;
+//cvar definitions:
+//"sv_playerphysicsqc" (0/1, default 1, allows user to disable qc player physics)
+//engine-called QC prototypes:
+//void() SV_PlayerPhysics;
+//description:
+//.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit)
+
+//DP_SV_PRECACHEANYTIME
+//idea: id Software (Quake2)
+//darkplaces implementation: LordHavoc
+//description:
+//this extension allows precache_model and precache_sound (and any variants) to be used during the game (with automatic messages to clients to precache the new model/sound indices), also setmodel/sound/ambientsound can be called without precaching first (they will cause an automatic precache).
+
+//DP_SV_ROTATINGBMODEL
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//this extension merely indicates that MOVETYPE_PUSH supports avelocity, allowing rotating brush models to be created, they rotate around their origin (needs rotation supporting qbsp/light utilities because id ones expected bmodel entity origins to be '0 0 0', recommend setting "origin" key in the entity fields in the map before compiling, there may be other methods depending on your qbsp, most are more complicated however).
+//tip: level designers can create a func_wall with an origin, and avelocity (for example "avelocity" "0 90 0"), and "nextthink" "99999999" to make a rotating bmodel without any qc modifications, such entities will be solid in stock quake but will not rotate)
+
+//DP_SV_SETCOLOR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity ent, float colors) setcolor = #401;
+//engine called QC functions (optional):
+//void(float color) SV_ChangeTeam;
+//description:
+//setcolor sets the color on a client and updates internal color information accordingly (equivilant to stuffing a "color" command but immediate)
+//SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this.
+//the color format is pants + shirt * 16 (0-255 potentially)
+
+//DP_SV_SLOWMO
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//cvars:
+//"slowmo" (0+, default 1)
+//description:
+//sets the time scale of the server, mainly intended for use in singleplayer by the player, however potentially useful for mods, so here's an extension for it.
+//range is 0 to infinite, recommended values to try are 0.1 (very slow, 10% speed), 1 (normal speed), 5 (500% speed).
+
+//DP_SV_WRITEUNTERMINATEDSTRING
+//idea: shadowalker
+//darkplaces implementation: Sajt
+//builtin definitions:
+void(float to, string s) WriteUnterminatedString = #456;
+//description:
+//like WriteString, but does not write a terminating 0 after the string. This means you can include things like a player's netname in the middle of a string sent over the network. Just be sure to end it up with either a call to WriteString (which includes the trailing 0) or WriteByte(0) to terminate it yourself.
+
+//DP_TE_BLOOD
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector velocity, float howmany) te_blood = #405;
+//temp entity definitions:
+float TE_BLOOD = 50;
+//protocol:
+//vector origin
+//byte xvelocity (-128 to +127)
+//byte yvelocity (-128 to +127)
+//byte zvelocity (-128 to +127)
+//byte count (0 to 255, how much blood)
+//description:
+//creates a blood effect.
+
+//DP_TE_BLOODSHOWER
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
+//temp entity definitions:
+//float TE_BLOODSHOWER = 52;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//coord explosionspeed (velocity of blood particles flying out of the center)
+//short count (number of blood particles)
+//description:
+//creates an exploding shower of blood, for making gibbings more convincing.
+
+//DP_TE_CUSTOMFLASH
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
+//temp entity definitions:
+//float TE_CUSTOMFLASH = 73;
+//protocol:
+//vector origin
+//byte radius ((MSG_ReadByte() + 1) * 8, meaning 8-2048 unit radius)
+//byte lifetime ((MSG_ReadByte() + 1) / 256.0, meaning approximately 0-1 second lifetime)
+//byte red (0.0 to 1.0 converted to 0-255)
+//byte green (0.0 to 1.0 converted to 0-255)
+//byte blue (0.0 to 1.0 converted to 0-255)
+//description:
+//creates a customized light flash.
+
+//DP_TE_EXPLOSIONRGB
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector color) te_explosionrgb = #407;
+//temp entity definitions:
+//float TE_EXPLOSIONRGB = 53;
+//protocol:
+//vector origin
+//byte red (0.0 to 1.0 converted to 0 to 255)
+//byte green (0.0 to 1.0 converted to 0 to 255)
+//byte blue (0.0 to 1.0 converted to 0 to 255)
+//description:
+//creates a colored explosion effect.
+
+//DP_TE_FLAMEJET
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector vel, float howmany) te_flamejet = #457;
+//temp entity definitions:
+//float TE_FLAMEJET = 74;
+//protocol:
+//vector origin
+//vector velocity
+//byte count (0 to 255, how many flame particles)
+//description:
+//creates a single puff of flame particles. (not very useful really)
+
+//DP_TE_PARTICLECUBE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
+//temp entity definitions:
+//float TE_PARTICLECUBE = 54;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity
+//short count
+//byte color (palette color)
+//byte gravity (TRUE or FALSE, FIXME should this be a scaler instead?)
+//coord randomvel (how much to jitter the velocity)
+//description:
+//creates a cloud of particles, useful for forcefields but quite customizable.
+
+//DP_TE_PARTICLERAIN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
+//temp entity definitions:
+//float TE_PARTICLERAIN = 55;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity (velocity of particles)
+//short count (number of particles)
+//byte color (8bit palette color)
+//description:
+//creates a shower of rain, the rain will appear either at the top (if falling down) or bottom (if falling up) of the cube.
+
+//DP_TE_PARTICLESNOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
+//temp entity definitions:
+//float TE_PARTICLERAIN = 56;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity (velocity of particles)
+//short count (number of particles)
+//byte color (8bit palette color)
+//description:
+//creates a shower of snow, the snow will appear either at the top (if falling down) or bottom (if falling up) of the cube, low velocities are advisable for convincing snow.
+
+//DP_TE_PLASMABURN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_plasmaburn = #433;
+//temp entity definitions:
+//float TE_PLASMABURN = 75;
+//protocol:
+//vector origin
+//description:
+//creates a small light flash (radius 200, time 0.2) and marks the walls.
+
+//DP_TE_QUADEFFECTS1
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_gunshotquad = #412;
+void(vector org) te_spikequad = #413;
+void(vector org) te_superspikequad = #414;
+void(vector org) te_explosionquad = #415;
+//temp entity definitions:
+//float TE_GUNSHOTQUAD = 57; // [vector] origin
+//float TE_SPIKEQUAD = 58; // [vector] origin
+//float TE_SUPERSPIKEQUAD = 59; // [vector] origin
+//float TE_EXPLOSIONQUAD = 70; // [vector] origin
+//protocol:
+//vector origin
+//description:
+//all of these just take a location, and are equivilant in function (but not appearance :) to the original TE_GUNSHOT, etc.
+
+//DP_TE_SMALLFLASH
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_smallflash = #416;
+//temp entity definitions:
+//float TE_SMALLFLASH = 72;
+//protocol:
+//vector origin
+//description:
+//creates a small light flash (radius 200, time 0.2).
+
+//DP_TE_SPARK
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector vel, float howmany) te_spark = #411;
+//temp entity definitions:
+//float TE_SPARK = 51;
+//protocol:
+//vector origin
+//byte xvelocity (-128 to 127)
+//byte yvelocity (-128 to 127)
+//byte zvelocity (-128 to 127)
+//byte count (number of sparks)
+//description:
+//creates a shower of sparks and a smoke puff.
+
+//DP_TE_STANDARDEFFECTBUILTINS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_gunshot = #418;
+void(vector org) te_spike = #419;
+void(vector org) te_superspike = #420;
+void(vector org) te_explosion = #421;
+void(vector org) te_tarexplosion = #422;
+void(vector org) te_wizspike = #423;
+void(vector org) te_knightspike = #424;
+void(vector org) te_lavasplash = #425;
+void(vector org) te_teleport = #426;
+void(vector org, float color, float colorlength) te_explosion2 = #427;
+void(entity own, vector start, vector end) te_lightning1 = #428;
+void(entity own, vector start, vector end) te_lightning2 = #429;
+void(entity own, vector start, vector end) te_lightning3 = #430;
+void(entity own, vector start, vector end) te_beam = #431;
+//description:
+//to make life easier on mod coders.
+
+//DP_VIEWZOOM
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float viewzoom;
+//description:
+//scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such)
+
+//FRIK_FILE
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(string s) stof = #81; // get numerical value from a string
+float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason
+void(float fhandle) fclose = #111; // closes a file
+string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring
+void(float fhandle, string s) fputs = #113; // writes a line of text to the end of the file
+float(string s) strlen = #114; // returns how many characters are in a string
+string(string s1, string s2, ...) strcat = #115; // concatenates two strings (for example "abc", "def" would return "abcdef") and returns as a tempstring
+string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring
+vector(string s) stov = #117; // returns vector value from a string
+string(string s) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
+void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
+//constants:
+float FILE_READ = 0;
+float FILE_APPEND = 1;
+float FILE_WRITE = 2;
+//cvars:
+//pr_zone_min_strings : default 64 (64k), min 64 (64k), max 8192 (8mb)
+//description:
+//provides text file access functions and string manipulation functions, note that you may want to set pr_zone_min_strings in the worldspawn function if 64k is not enough string zone space.
+
+//KRIMZON_SV_PARSECLIENTCOMMAND
+//idea: KrimZon
+//darkplaces implementation: KrimZon, LordHavoc
+//engine-called QC prototypes:
+//void(string s) SV_ParseClientCommand;
+//builtin definitions:
+void(entity e, string s) clientcommand = #440;
+float(string s) tokenize = #441;
+string(float n) argv = #442;
+//description:
+//provides QC the ability to completely control server interpretation of client commands ("say" and "color" for example, clientcommand is necessary for this and substring (FRIK_FILE) is useful) as well as adding new commands (tokenize, argv, and stof (FRIK_FILE) are useful for this)), whenever a clc_stringcmd is received the QC function is called, and it is up to the QC to decide what (if anything) to do with it
+
+//NEH_CMD_PLAY2
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports the "play2" console command (plays a sound without spatialization).
+
+//NEH_RESTOREGAME
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//engine-called QC prototypes:
+//void() RestoreGame;
+//description:
+//when a savegame is loaded, this function is called
+
+//NEXUIZ_PLAYERMODEL
+//idea: Nexuiz
+//darkplaces implementation: Black
+//console commands:
+//playermodel <name> - FIXME: EXAMPLE NEEDED
+//playerskin <name> - FIXME: EXAMPLE NEEDED
+//field definitions:
+.string playermodel; // name of player model sent by client
+.string playerskin; // name of player skin sent by client
+//description:
+//these client properties are used by Nexuiz.
+
+//NXQ_GFX_LETTERBOX
+//idea: nxQuake
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports the "r_letterbox" console variable, set to values in the range 0-100 this restricts the view vertically (and turns off sbar and crosshair), value is a 0-100 percentage of how much to constrict the view, <=0 = normal view height, 25 = 75% of normal view height, 50 = 50%, 75 = 25%, >=100 = no view
+
+//PRYDON_CLIENTCURSOR
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_SELECTABLE = 16384; // allows cursor to highlight entity (brighten)
+//field definitions:
+.float cursor_active; // true if cl_prydoncursor mode is on
+.vector cursor_screen; // screen position of cursor as -1 to +1 in _x and _y (_z unused)
+.vector cursor_trace_start; // position of camera
+.vector cursor_trace_endpos; // position of cursor in world (as traced from camera)
+.entity cursor_trace_ent; // entity the cursor is pointing at (server forces this to world if the entity is currently free at time of receipt)
+//cvar definitions:
+//cl_prydoncursor (0/1+, default 0, 1 and above use cursors named gfx/prydoncursor%03i.lmp - or .tga and such if DP_GFX_EXTERNALTEXTURES is implemented)
+//description:
+//shows that the engine supports the cl_prydoncursor cvar, this puts a clientside mouse pointer on the screen and feeds input to the server for the QuakeC to use as it sees fit.
+//the mouse pointer triggers button4 if cursor is at left edge of screen, button5 if at right edge of screen, button6 if at top edge of screen, button7 if at bottom edge of screen.
+//the clientside trace skips transparent entities (except those marked EF_SELECTABLE).
+//the selected entity highlights only if EF_SELECTABLE is set, a typical selection method would be doubling the brightness of the entity by some means (such as colormod[] *= 2).
+//intended to be used by Prydon Gate.
+
+//TENEBRAE_GFX_DLIGHTS
+//idea: Tenebrae
+//darkplaces implementation: LordHavoc
+//fields:
+.float light_lev; // radius (does not affect brightness), typical value 350
+.vector color; // color (does not affect radius), typical value '1 1 1' (bright white), can be up to '255 255 255' (nuclear blast)
+.float style; // light style (like normal light entities, flickering torches or switchable, etc)
+.float pflags; // flags (see PFLAGS_ constants)
+.vector angles; // orientation of the light
+.float skin; // cubemap filter number, can be 1-255 (0 is assumed to be none, and tenebrae only allows 16-255), this selects a projective light filter, a value of 1 loads cubemaps/1posx.tga and cubemaps/1negx.tga and posy, negy, posz, and negz, similar to skybox but some sides need to be rotated or flipped
+//constants:
+float PFLAGS_NOSHADOW = 1; // light does not cast shadows
+float PFLAGS_CORONA = 2; // light has a corona flare
+float PFLAGS_FULLDYNAMIC = 128; // light enable (without this set no light is produced!)
+//description:
+//more powerful dynamic light settings
+//warning: it is best not to use cubemaps on a light entity that has a model, as using a skin number that a model does not have will cause issues in glquake, and produce warnings in darkplaces (use developer 1 to see them)
+//changes compared to tenebrae (because they're too 'leet' for standards):
+//note: networking should send entities with PFLAGS_FULLDYNAMIC set even if they have no model (lights in general do not have a model, nor should they)
+//EF_FULLDYNAMIC effects flag replaced by PFLAGS_FULLDYNAMIC flag (EF_FULLDYNAMIC conflicts with EF_NODRAW)
+
+//TW_SV_STEPCONTROL
+//idea: Transfusion
+//darkplaces implementation: LordHavoc
+//cvars:
+//sv_jumpstep (0/1, default 1)
+//sv_stepheight (default 18)
+//description:
+//sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be.
+
Modified: trunk/basezym/progsqc/gamedefs.qc
===================================================================
--- trunk/basezym/progsqc/gamedefs.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/gamedefs.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,18 +1,37 @@
-
-// ladder info
-.float ladder_time;
-.entity ladder_entity;
-
-// gravity scaling (engine feature)
-// TODO: move to defs.qc or dpextensions.qc or something else?
-.float gravity;
-
-// multiplayer variables
-float teamplay;
-float timelimit;
-float fraglimit;
-
-// SV_PlayerPhysics variables
-float sv_airmaxspeed, sv_maxspeed, sv_friction, sv_accelerate, sv_stopspeed, sv_gravity;
-//float sv_edgefriction, cl_divspeed, cl_rollangle;
-
+
+// ladder info
+.float ladder_time;
+.entity ladder_entity;
+
+.float fade_time;
+.float fade_rate;
+.vector finaldest, finalangle;
+
+// gravity scaling (engine feature)
+// TODO: move to defs.qc or dpextensions.qc or something else?
+.float gravity;
+
+// multiplayer variables
+float teamplay;
+float timelimit;
+float fraglimit;
+
+// SV_PlayerPhysics variables
+float sv_airmaxspeed, sv_maxspeed, sv_friction, sv_accelerate, sv_stopspeed, sv_gravity;
+//float sv_edgefriction, cl_divspeed, cl_rollangle;
+
+
+vector PL_MIN = '-16 -16 -24';
+vector PL_MAX = '16 16 24';
+vector PL_VIEW_OFS = '0 0 22';
+vector PL_WEAPON_OFS = '0 4 16';
+float PL_JUMPSPEED = 175;
+
+float PLAYER_HEALTH_START = 100;
+float PLAYER_HEALTH_MAX = 200;
+float PLAYER_SHIELD_START = 200;
+float PLAYER_SHIELD_MAX = 600;
+float PLAYER_SHIELD_REGENRATE = 20;
+float PLAYER_SHIELD_REGENMAX = 200;
+
+float PLAYER_FALLDAMAGE = 30;
Modified: trunk/basezym/progsqc/inventory.qc
===================================================================
--- trunk/basezym/progsqc/inventory.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/inventory.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -4,58 +4,24 @@
float ITEMTYPE_NONE = -1;
-float ITEMTYPE_ASSAULTRAILGUN = 0;
-float ITEMTYPE_CRYLINK = 1;
-float ITEMTYPE_MINIGUN = 2;
-float ITEMTYPE_HAGAR = 3;
-float ITEMTYPE_RPG = 4;
-float ITEMTYPE_SNIPERRAILGUN = 5;
+float ITEMTYPE_WEAP1 = 0;
+float ITEMTYPE_WEAP2 = 1;
+float ITEMTYPE_WEAP3 = 2;
+float ITEMTYPE_WEAP4 = 3;
+float ITEMTYPE_WEAP5 = 4;
+float ITEMTYPE_WEAP6 = 5;
+float ITEMTYPE_WEAP7 = 6;
-float ITEMTYPE_ASSAULTRAILGUN_AMMO = 6;
-float ITEMTYPE_CRYLINK_AMMO = 7;
-float ITEMTYPE_HAGAR_AMMO = 8;
-float ITEMTYPE_MINIGUN_AMMO = 9;
-float ITEMTYPE_RPG_AMMO = 10;
-float ITEMTYPE_SNIPERRAILGUN_AMMO = 11;
+float ITEMTYPE_WEAP1_AMMO = 7;
+float ITEMTYPE_WEAP2_AMMO = 8;
+float ITEMTYPE_WEAP3_AMMO = 9;
+float ITEMTYPE_WEAP4_AMMO = 10;
+float ITEMTYPE_WEAP5_AMMO = 11;
+float ITEMTYPE_WEAP6_AMMO = 12;
+float ITEMTYPE_WEAP7_AMMO = 13;
-float ITEMTYPE_TOTAL = 12;
+float ITEMTYPE_TOTAL = 14;
-/*
-string itemtype_model[ITEMTYPE_TOTAL] =
-{
- "models/items/assaultrailgun.md3",
- "models/items/crylink.md3",
- "models/items/hagar.md3",
- "models/items/minigun.md3",
- "models/items/rpg.md3",
- "models/items/sniperrailgun.md3",
-
- "models/items/minigun_clip.dpm",
- "models/items/hagar_clip.dpm",
- "models/items/rpg_clip.dpm",
- "models/items/sniperrailgun_clip.dpm",
-};
-*/
-
-/*
-float itemtype_info[ITEMTYPE_TOTAL5] =
-{
- 1, 3, ITEMTYPE_HAGAR_AMMO, 0, ITEMTYPE_NONE,
- 1, 100, ITEMTYPE_MINIGUN_AMMO, 0, ITEMTYPE_NONE,
- 1, 1, ITEMTYPE_RPG_AMMO, 0, ITEMTYPE_NONE,
- 1, 1, ITEMTYPE_SNIPERRAILGUN_AMMO, 0, ITEMTYPE_NONE,
- 225, 45, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 40, 8, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 20, 4, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 100, 20, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 15, 3, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 30, 6, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 5, 1, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 5, 1, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
- 5, 1, ITEMTYPE_NONE, 0, ITEMTYPE_NONE,
-};
-*/
-
float WS_IDLE = 0;
float WS_FIRE1 = 1;
float WS_FIRE2 = 2;
@@ -88,6 +54,10 @@
float iteminfo_ammo2minimumtofire;
float iteminfo_ammo1itemtype;
float iteminfo_ammo2itemtype;
+float iteminfo_ammo1numberof;
+float iteminfo_ammo2numberof;
+float iteminfo_ammo1recoil;
+float iteminfo_ammo2recoil;
vector iteminfo_ammo1damage;
vector iteminfo_ammo2damage;
float iteminfo_ammo1damagetype;
@@ -146,7 +116,10 @@
local entity e;
local float d;
if (itemtype < 0)
- error("itemtype < 0\n");
+ {
+ bprint(iteminfo_name);
+ //error("itemtype = ",ftos(itemtype),"\n");
+ }
if (itemtype >= ITEMTYPE_TOTAL)
error("itemtype >= ITEMTYPE_TOTAL\n");
iteminfo_itemtype = itemtype;
@@ -157,6 +130,7 @@
iteminfo_ammo1inventory = 0;
iteminfo_ammo2inventory = 0;
+
iteminfo_model = "";
iteminfo_name = "unknown";
iteminfo_pickupsound = "";
@@ -174,6 +148,8 @@
iteminfo_ammo1firesound = "";
iteminfo_ammo1explodesound = "";
iteminfo_ammo1bouncesound = "";
+ iteminfo_ammo1numberof = 1;
+ iteminfo_ammo1recoil = 0;
iteminfo_ammo2max = 0;
iteminfo_ammo2inventorymax = 0;
iteminfo_ammo2minimumtofire = 0;
@@ -187,6 +163,8 @@
iteminfo_ammo2firesound = "";
iteminfo_ammo2explodesound = "";
iteminfo_ammo2bouncesound = "";
+ iteminfo_ammo2numberof = 1;
+ iteminfo_ammo2recoil = 0;
iteminfo_weapon_viewmodel = "";
iteminfo_weapon_viewmodelanim_idle = '0 0 1';
iteminfo_weapon_viewmodelanim_fire1 = '0 0 2';
@@ -201,212 +179,107 @@
iteminfo_weapon_canreload = FALSE;
iteminfo_weapon_canraise = FALSE;
iteminfo_weapon_rank = 0;
- if (itemtype == ITEMTYPE_ASSAULTRAILGUN)
+
+
+ if (itemtype < ITEMTYPE_WEAP1_AMMO)
{
- iteminfo_name = "assault railgun";
- iteminfo_model = "models/items/assaultrailgun.md3";
- iteminfo_pickupsound = "items/pickupweapon.wav";
+ // set the settings for all weapons
iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 80;
- iteminfo_ammo1itemtype = ITEMTYPE_ASSAULTRAILGUN_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_ASSAULTRAILGUN_BULLET;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT;// | PROJECTILEFLAG_RICOCHET;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '10 10 0';
- iteminfo_ammo1speeds = '20000 0 300';
- iteminfo_ammo1model = "models/weapons/bullet.mdl";
- iteminfo_ammo1firesound = "weapons/assaultrailgun_bulletfire1.wav"; // templeofnoise
- // iteminfo_ammo1explodesound = "weapons/assaultrailgun_bulletimpact.wav"; // templeofnoise: using minigun ones
- iteminfo_ammo1inventorymax = 80;
- iteminfo_weapon_viewmodel = "models/items/assaultrailgun.md3";
- iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 10';
- iteminfo_weapon_viewmodelanim_reload = '0 0 1';
- iteminfo_weapon_viewmodelanim_lower = '0 0 2';
- iteminfo_weapon_viewmodelanim_raise = '0 0 2';
- }
- else if (itemtype == ITEMTYPE_CRYLINK)
- {
- iteminfo_name = "crylink";
- iteminfo_model = "models/items/crylink.md3";
iteminfo_pickupsound = "items/pickupweapon.wav";
- iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 90;
- iteminfo_ammo1itemtype = ITEMTYPE_CRYLINK_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_CRYLINK_SHOT;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT | PROJECTILEFLAG_PLASMA | PROJECTILEFLAG_MUZZLEFLASH | PROJECTILEFLAG_GLOW | PROJECTILEFLAG_ROCKET;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '60 20000 100';
- iteminfo_ammo1speeds = '1500 0 30';
- iteminfo_ammo1inventorymax = 90;
- iteminfo_ammo1model = "models/weapons/crylink_bullet.mdl";
- iteminfo_ammo1firesound = "weapons/crylink_shot.wav";
- iteminfo_ammo1explodesound = "weapons/crylink_shotexplode.wav";
- iteminfo_weapon_viewmodel = "models/items/crylink.md3";
iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 2';
- iteminfo_weapon_viewmodelanim_fire2 = '0 0 3';
iteminfo_weapon_viewmodelanim_reload = '0 0 1';
iteminfo_weapon_viewmodelanim_lower = '0 0 2';
iteminfo_weapon_viewmodelanim_raise = '0 0 2';
+
+ string wname;
+ wname = strcat("g_weap",ftos(itemtype + 1));
+ iteminfo_ammo1itemtype = ITEMTYPE_WEAP1_AMMO + itemtype;
+ iteminfo_ammo1damagetype = DAMAGETYPE_WEAP1 + itemtype;
+ iteminfo_ammo2itemtype = ITEMTYPE_WEAP1_AMMO + itemtype;
+ iteminfo_ammo2damagetype = DAMAGETYPE_WEAP1 + itemtype;
+
+ iteminfo_name = cvar_string(wname);
+ iteminfo_model = cvar_string(wname,"_model");
+ iteminfo_weapon_viewmodel = cvar_string(wname,"_viewmodel");
+
+ iteminfo_ammo1damage = stov(cvar_string(wname,"_ammo1damage"));
+ iteminfo_ammo1speeds = stov(cvar_string(wname,"_ammo1speeds"));
+ iteminfo_ammo1model = cvar_string(wname,"_ammo1model");
+ iteminfo_ammo1firesound = cvar_string(wname,"_ammo1firesound");
+ iteminfo_ammo1max = cvar(wname,"_ammo1max");
+ iteminfo_ammo1inventorymax = cvar(wname,"_ammo1max");
+ iteminfo_ammo1flags = cvar(wname,"_ammo1flags");
+ iteminfo_ammo1numberof = cvar(wname,"_ammo1numberof");
+ iteminfo_ammo1recoil = cvar(wname,"_ammo1recoil");
+ iteminfo_ammo1minimumtofire = cvar(wname,"_ammo1mintofire");
+ iteminfo_ammo1lifetime = cvar(wname,"_ammo1lifetime");
+ iteminfo_weapon_viewmodelanim_fire1 = stov(cvar_string(wname,"_fire1"));
+
+ iteminfo_ammo2damage = stov(cvar_string(wname,"_ammo2damage"));
+ iteminfo_ammo2speeds = stov(cvar_string(wname,"_ammo2speeds"));
+ iteminfo_ammo2model = cvar_string(wname,"_ammo2model");
+ iteminfo_ammo2firesound = cvar_string(wname,"_ammo2firesound");
+ iteminfo_ammo2max = cvar(wname,"_ammo2max");
+ iteminfo_ammo2inventorymax = cvar(wname,"_ammo2max");
+ iteminfo_ammo2flags = cvar(wname,"_ammo2flags");
+ iteminfo_ammo2numberof = cvar(wname,"_ammo2numberof");
+ iteminfo_ammo2recoil = cvar(wname,"_ammo2recoil");
+ iteminfo_ammo2minimumtofire = cvar(wname,"_ammo2mintofire");
+ iteminfo_ammo2lifetime = cvar(wname,"_ammo2lifetime");
+ iteminfo_weapon_viewmodelanim_fire2 = stov(cvar_string(wname,"_fire2"));
}
- else if (itemtype == ITEMTYPE_MINIGUN)
+ else if (itemtype == ITEMTYPE_WEAP1_AMMO)
{
- iteminfo_name = "minigun";
- iteminfo_model = "models/items/minigun.md3";
- iteminfo_pickupsound = "items/pickupweapon.wav";
- iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 600;
- iteminfo_ammo1itemtype = ITEMTYPE_MINIGUN_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_MINIGUN_RAPID;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '30 20 5';
- iteminfo_ammo1speeds = '20000 0 600';
- iteminfo_ammo1inventorymax = 600;
- iteminfo_ammo1model = "models/weapons/bullet.mdl";
- iteminfo_ammo1firesound = "weapons/minigun_bulletfire1.wav"; // templeofnoise
- iteminfo_ammo1explodesound = "weapons/bullet_ric1.wav"; // templeofnoise
- iteminfo_weapon_viewmodel = "models/items/minigun.md3";
- iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 20';
- iteminfo_weapon_viewmodelanim_fire2 = '0 0 4';
- iteminfo_weapon_viewmodelanim_reload = '0 0 1';
- iteminfo_weapon_viewmodelanim_lower = '0 0 2';
- iteminfo_weapon_viewmodelanim_raise = '0 0 2';
+ iteminfo_name = cvar_string("g_weap1_ammo_name");
+ iteminfo_model = cvar_string("g_weap1_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap1_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap1_quantitymax");
}
- else if (itemtype == ITEMTYPE_HAGAR)
+ else if (itemtype == ITEMTYPE_WEAP2_AMMO)
{
- iteminfo_name = "hagar";
- iteminfo_model = "models/items/hagar.md3";
- iteminfo_pickupsound = "items/pickupweapon.wav";
- iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 60;
- iteminfo_ammo1itemtype = ITEMTYPE_HAGAR_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_HAGAR_ROCKET;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT | PROJECTILEFLAG_EXPLODE | PROJECTILEFLAG_ROCKET | PROJECTILEFLAG_MUZZLEFLASH;// | PROJECTILEFLAG_RICOCHET;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '120 20000 30';
- iteminfo_ammo1speeds = '2000 0 2';
- iteminfo_ammo1inventorymax = 60;
- iteminfo_ammo1model = "models/weapons/hagar_rocket.md3";
- iteminfo_ammo1firesound = "weapons/hagar_rocketfire.wav";
- iteminfo_ammo1explodesound = "weapons/hagar_rocketexplode.wav";
- iteminfo_ammo2max = 60;
- iteminfo_ammo2itemtype = ITEMTYPE_HAGAR_AMMO;
- iteminfo_ammo2damagetype = DAMAGETYPE_HAGAR_ROCKET;
- iteminfo_ammo2flags = PROJECTILEFLAG_ANYIMPACT | PROJECTILEFLAG_EXPLODE | PROJECTILEFLAG_ROCKET | PROJECTILEFLAG_MUZZLEFLASH;// | PROJECTILEFLAG_RICOCHET;
- iteminfo_ammo2minimumtofire = 1;
- iteminfo_ammo2damage = '120 20000 30';
- iteminfo_ammo2speeds = '500 0 2';
- iteminfo_ammo2inventorymax = 60;
- iteminfo_ammo2model = "models/weapons/hagar_rocket.md3";
- iteminfo_ammo2firesound = "weapons/hagar_rocketfire.wav";
- iteminfo_ammo2explodesound = "weapons/hagar_rocketexplode.wav";
- iteminfo_weapon_viewmodel = "models/items/hagar.md3";
- iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 3';
- iteminfo_weapon_viewmodelanim_fire2 = '0 0 1';
- iteminfo_weapon_viewmodelanim_reload = '0 0 1';
- iteminfo_weapon_viewmodelanim_lower = '0 0 2';
- iteminfo_weapon_viewmodelanim_raise = '0 0 2';
+ iteminfo_name = cvar_string("g_weap2_ammo_name");
+ iteminfo_model = cvar_string("g_weap2_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap2_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap2_quantitymax");
}
- else if (itemtype == ITEMTYPE_RPG)
+ else if (itemtype == ITEMTYPE_WEAP3_AMMO)
{
- iteminfo_name = "rocket propelled grenade launcher";
- iteminfo_model = "models/items/rpg.md3";
- iteminfo_pickupsound = "items/pickupweapon.wav";
- iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 20;
- iteminfo_ammo1itemtype = ITEMTYPE_RPG_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_RPG_ROCKET;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT | PROJECTILEFLAG_EXPLODELARGE | PROJECTILEFLAG_ROCKET | PROJECTILEFLAG_REMOTEDETONATE | PROJECTILEFLAG_MUZZLEFLASH | PROJECTILEFLAG_SEMIAUTOMATIC;// | PROJECTILEFLAG_RICOCHET;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '300 90000 250';
- iteminfo_ammo1speeds = '750 0 5';
- iteminfo_ammo1inventorymax = 20;
- iteminfo_ammo1model = "models/weapons/rpg_rocket.md3";
- iteminfo_ammo1firesound = "weapons/rpg_rocketfire.wav";
- iteminfo_ammo1explodesound = "weapons/rpg_rocketexplode.wav";
- iteminfo_ammo2firesound = "weapons/rpg_detonatorsound.wav";
- iteminfo_ammo2bouncesound = "weapons/rpg_rocketdetonatebeep.wav";
- iteminfo_weapon_viewmodel = "models/items/rpg.md3";
- iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 2';
- iteminfo_weapon_viewmodelanim_fire2 = '0 0 30';
- iteminfo_weapon_viewmodelanim_reload = '0 0 0.5';
- iteminfo_weapon_viewmodelanim_lower = '0 0 2';
- iteminfo_weapon_viewmodelanim_raise = '0 0 2';
+ iteminfo_name = cvar_string("g_weap3_ammo_name");
+ iteminfo_model = cvar_string("g_weap3_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap3_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap3_quantitymax");
}
- else if (itemtype == ITEMTYPE_SNIPERRAILGUN)
+ else if (itemtype == ITEMTYPE_WEAP4_AMMO)
{
- iteminfo_name = "sniper railgun";
- iteminfo_model = "models/items/sniperrailgun.md3";
- iteminfo_pickupsound = "items/pickupweapon.wav";
- iteminfo_quantitymax = 1;
- iteminfo_ammo1max = 40;
- iteminfo_ammo1itemtype = ITEMTYPE_SNIPERRAILGUN_AMMO;
- iteminfo_ammo1damagetype = DAMAGETYPE_SNIPERRAILGUN_BULLET;
- iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT | PROJECTILEFLAG_PLASMALARGE | PROJECTILEFLAG_MUZZLEFLASH | PROJECTILEFLAG_SEMIAUTOMATIC;
- iteminfo_ammo1minimumtofire = 1;
- iteminfo_ammo1damage = '250 1500 5';
- iteminfo_ammo1speeds = '200000 0 200';
- iteminfo_ammo1inventorymax = 40;
- iteminfo_ammo1model = "models/weapons/bullet.mdl";
- iteminfo_ammo1firesound = "weapons/sniperrailgun_bulletfire.wav";
- iteminfo_ammo1explodesound = "weapons/sniperrailgun_bulletimpact.wav";
- iteminfo_weapon_viewmodel = "models/items/sniperrailgun.md3";
- iteminfo_weapon_viewmodelanim_idle = '0 0 30';
- iteminfo_weapon_viewmodelanim_fire1 = '0 0 6';
- iteminfo_weapon_viewmodelanim_fire2 = '0 0 30';
- iteminfo_weapon_viewmodelanim_reload = '0 0 1';
- iteminfo_weapon_viewmodelanim_lower = '0 0 2';
- iteminfo_weapon_viewmodelanim_raise = '0 0 2';
+ iteminfo_name = cvar_string("g_weap4_ammo_name");
+ iteminfo_model = cvar_string("g_weap4_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap4_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap4_quantitymax");
}
- else if (itemtype == ITEMTYPE_ASSAULTRAILGUN_AMMO)
+ else if (itemtype == ITEMTYPE_WEAP5_AMMO)
{
- iteminfo_name = "assault railgun clip";
- iteminfo_model = "models/items/assaultrailgun_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 80;
+ iteminfo_name = cvar_string("g_weap5_ammo_name");
+ iteminfo_model = cvar_string("g_weap5_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap5_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap5_quantitymax");
}
- else if (itemtype == ITEMTYPE_CRYLINK_AMMO)
+ else if (itemtype == ITEMTYPE_WEAP6_AMMO)
{
- iteminfo_name = "crylink cells";
- iteminfo_model = "models/items/crylink_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 90;
+ iteminfo_name = cvar_string("g_weap6_ammo_name");
+ iteminfo_model = cvar_string("g_weap6_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap6_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap6_quantitymax");
}
- else if (itemtype == ITEMTYPE_HAGAR_AMMO)
+ else if (itemtype == ITEMTYPE_WEAP7_AMMO)
{
- iteminfo_name = "hagar rocket pack";
- iteminfo_model = "models/items/hagar_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 60;
+ iteminfo_name = cvar_string("g_weap7_ammo_name");
+ iteminfo_model = cvar_string("g_weap7_ammo_model");
+ iteminfo_pickupsound = cvar_string("g_weap7_ammo_pickupsound");
+ iteminfo_quantitymax = cvar("g_weap7_quantitymax");
}
- else if (itemtype == ITEMTYPE_MINIGUN_AMMO)
- {
- iteminfo_name = "minigun bullet pack";
- iteminfo_model = "models/items/minigun_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 600;
- }
- else if (itemtype == ITEMTYPE_RPG_AMMO)
- {
- iteminfo_name = "rocket propelled grenade";
- iteminfo_model = "models/items/rpg_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 20;
- }
- else if (itemtype == ITEMTYPE_SNIPERRAILGUN_AMMO)
- {
- iteminfo_name = "sniper railgun clip";
- iteminfo_model = "models/items/sniperrailgun_clip.dpm";
- iteminfo_pickupsound = "items/pickupammo.wav";
- iteminfo_quantitymax = 40;
- }
else
- error("Inventory_GetItemInfo: unknown itemtype\n");
+ error(ftos(itemtype)," Inventory_GetItemInfo: unknown itemtype\n");
+
if (iteminfo_quantity >= 1)
{
if (iteminfo_ammo1itemtype == itemtype)
@@ -437,7 +310,7 @@
}
iteminfo_weapon_canreload = (iteminfo_ammo1 < iteminfo_ammo1max && iteminfo_ammo1inventory >= 1) || (iteminfo_ammo2 < iteminfo_ammo2max && iteminfo_ammo2inventory >= 1);
iteminfo_weapon_canfire1 = iteminfo_ammo1 >= iteminfo_ammo1minimumtofire;
- if (itemtype == ITEMTYPE_RPG)
+ if (iteminfo_ammo1flags & PROJECTILEFLAG_REMOTEDETONATE)
{
// one ammo type, but special altfire
// see if any remote detonate projectiles exist, and if so
@@ -702,35 +575,35 @@
/*
// _x = quantity, _y = ammo type, _z = ammo quantity
-.vector inventory_assaultrailgun;
-.float inventory_assaultrailgun_clip_steel;
-.vector inventory_crylink;
-.float inventory_crylink_clip;
-.vector inventory_hagar;
-.float inventory_hagar_clip_ap;
-.float inventory_hagar_clip_he;
-.vector inventory_minigun;
-.float inventory_minigun_clip_i;
-.vector inventory_rpg;
-.float inventory_rpg_clip_he;
-.vector inventory_sniperrailgun;
-.float inventory_sniperrailgun_clip;
+.vector inventory_weap1;
+.float inventory_weap1_clip_steel;
+.vector inventory_weap2;
+.float inventory_weap2_clip;
+.vector inventory_weap3;
+.float inventory_weap3_clip_ap;
+.float inventory_weap3_clip_he;
+.vector inventory_weap4;
+.float inventory_weap4_clip_i;
+.vector inventory_weap5;
+.float inventory_weap5_clip_he;
+.vector inventory_weap6;
+.float inventory_weap6;
void(entity character) Inventory_Clear =
{
- character.inventory_assaultrailgun = '0 0 0';
- character.inventory_assaultrailgun_clip_steel = 0;
- character.inventory_crylink = '0 0 0';
- character.inventory_crylink_clip = 0;
- character.inventory_hagar = '0 0 0';
- character.inventory_hagar_clip_ap = 0;
- character.inventory_hagar_clip_he = 0;
- character.inventory_minigun = '0 0 0';
- character.inventory_minigun_clip_i = 0;
- character.inventory_rpg = '0 0 0';
- character.inventory_rpg_clip_he = 0;
- character.inventory_sniperrailgun = '0 0 0';
- character.inventory_sniperrailgun_clip = 0;
+ character.inventory_weap1 = '0 0 0';
+ character.inventory_weap1_clip_steel = 0;
+ character.inventory_weap2 = '0 0 0';
+ character.inventory_weap2_clip = 0;
+ character.inventory_weap3 = '0 0 0';
+ character.inventory_weap3_clip_ap = 0;
+ character.inventory_weap3_clip_he = 0;
+ character.inventory_weap4 = '0 0 0';
+ character.inventory_weap4_clip_i = 0;
+ character.inventory_weap5 = '0 0 0';
+ character.inventory_weap5_clip_he = 0;
+ character.inventory_weap6 = '0 0 0';
+ character.inventory_weap6_clip = 0;
};
float ITEMTYPE_EMPTY = 0;
Added: trunk/basezym/progsqc/jumppads.qc
===================================================================
--- trunk/basezym/progsqc/jumppads.qc (rev 0)
+++ trunk/basezym/progsqc/jumppads.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -0,0 +1,208 @@
+float PUSH_ONCE = 1;
+float PUSH_SILENT = 2;
+
+.float pushltime;
+.float height;
+.float jumppadcount;
+
+float trigger_push_calculatevelocity_flighttime;
+
+/*
+ trigger_push_calculatevelocity
+
+ Arguments:
+ org - origin of the object which is to be pushed
+ tgt - target entity (can be either a point or a model entity; if it is
+ the latter, its midpoint is used)
+ ht - jump height, measured from the higher one of org and tgt's midpoint
+
+ Returns: velocity for the jump
+ the global trigger_push_calculatevelocity_flighttime is set to the total
+ jump time
+ */
+
+vector(vector org, entity tgt, float ht) trigger_push_calculatevelocity =
+{
+ local float grav, sdist, zdist, vs, vz, jumpheight, trajsign;
+ local vector sdir, torg;
+
+ torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
+
+ grav = cvar("sv_gravity");
+
+ zdist = torg_z - org_z;
+ sdist = vlen(torg - org - zdist * '0 0 1');
+ sdir = normalize(torg - org - zdist * '0 0 1');
+
+ // how high do we need to push the player?
+ jumpheight = fabs(ht);
+ if(zdist > 0)
+ jumpheight = jumpheight + zdist;
+
+ /*
+ STOP.
+
+ You will not understand the following equations anyway...
+ But here is what I did to get them.
+
+ I used the functions
+
+ s(t) = t * vs
+ z(t) = t * vz - 1/2 grav t^2
+
+ and solved for:
+
+ s(ti) = sdist
+ z(ti) = zdist
+ max(z, ti) = jumpheight
+
+ From these three equations, you will find the three parameters vs, vz
+ and ti.
+ */
+
+ // push him so high...
+ vz = sqrt(2 * grav * jumpheight); // NOTE: sqrt(positive)!
+ if(ht < 0)
+ if(zdist < 0)
+ vz = -vz;
+
+ // how far to push him?
+ if(zdist == 0)
+ {
+ trigger_push_calculatevelocity_flighttime = sqrt(jumpheight * 8 / grav);
+ vs = sdist / trigger_push_calculatevelocity_flighttime;
+ // trajsign is ignored (the high point MUST be inside the jump!)
+ }
+ else
+ {
+ if(ht > 0)
+ trajsign = +1;
+ else
+ trajsign = -1;
+
+ // >0: the lower speed that achieves "it"
+ // (parabola's maximum inside the jump)
+ // <0: the higher speed that achieves "it"
+ // (parabola's maximum outside the jump)
+
+ vs = sqrt(jumpheight - zdist);
+ vs = sqrt(jumpheight) - trajsign * vs; // fteqcc sucks
+ vs = fabs(vs * sqrt(grav/2) / zdist);
+ //vs = fabs((sdist / zdist) * sqrt(grav/2) * (sqrt(jumpheight) - trajsign * sqrt(jumpheight - zdist)));
+ trigger_push_calculatevelocity_flighttime = 1 / vs;
+ // note: vs cannot be zero here. The difference between the sqrts is zero IFF zdist == 0, which we have excluded.
+ vs = vs * sdist;
+
+ // cases to test: "jump up", "jump down" with positive and negative height
+ }
+
+ // finally calculate the velocity
+ return sdir * vs + '0 0 1' * vz;
+}
+
+void() trigger_push_touch =
+{
+
+ if (other.deadflag && other.classname == "player")
+ return;
+
+ if (!self.target)
+ {
+ other.velocity = self.movedir;
+ other.flags = other.flags - (other.flags & FL_ONGROUND);
+ return;
+ }
+
+ if (other.classname == "player")
+ {
+ if(self.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once
+ {
+ sound (other, CHAN_ITEM, "misc/jumppad.wav", 1, ATTN_NORM);
+ self.pushltime = time + 0.2;
+ }
+ }
+
+ self.movedir = trigger_push_calculatevelocity(other.origin, self.enemy, self.height);
+
+ other.flags = other.flags - (other.flags & FL_ONGROUND);
+
+ if (self.spawnflags & PUSH_ONCE)
+ {
+ self.touch = SUB_Null;
+ self.think = SUB_Remove;
+ self.nextthink = time;
+ }
+};
+
+.vector dest;
+
+void() trigger_push_findtarget =
+{
+ local entity e;
+ local vector org;
+ local float flighttime;
+
+ // first calculate a typical start point for the jump
+ org = (self.absmin + self.absmax) * 0.5;
+ org_z = self.absmax_z - PL_MIN_z;
+
+ if (self.target)
+ {
+ // find the target
+ self.enemy = find(world, targetname, self.target);
+ if (!self.enemy)
+ {
+ objerror("trigger_push: target not found\n");
+ remove(self);
+ return;
+ }
+
+ self.movedir = trigger_push_calculatevelocity(org, self.enemy, self.height);
+ flighttime = trigger_push_calculatevelocity_flighttime;
+ }
+ else
+ flighttime = 0;
+
+};
+
+/*
+ * ENTITY PARAMETERS:
+ *
+ * target: target of jump
+ * height: the absolute value is the height of the highest point of the jump
+ * trajectory above the higher one of the player and the target.
+ * the sign indicates whether the highest point is INSIDE (positive)
+ * or OUTSIDE (negative) of the jump trajectory. General rule: use
+ * positive values for targets mounted on the floor, and use negative
+ * values to target a point on the ceiling.
+ * movedir: if target is not set, this * speed * 10 is the velocity to be reached.
+ */
+void() trigger_push =
+{
+ if (self.angles != '0 0 0')
+ SetMovedir ();
+
+ self.solid = SOLID_TRIGGER;
+ setmodel (self, self.model); // no precision needed
+ self.movetype = MOVETYPE_NONE;
+ self.modelindex = 0;
+ self.model = "";
+
+ self.touch = trigger_push_touch;
+
+ // normal push setup
+ if (!self.speed)
+ self.speed = 1000;
+ self.movedir = self.movedir * self.speed * 10;
+
+ if (self.target)
+ precache_sound ("misc/jumppad.wav");
+
+ // this must be called to spawn the teleport waypoints for bots
+ self.think = trigger_push_findtarget;
+ self.nextthink = time + 0.2;
+};
+
+void() target_push = {};
+void() info_notnull = {};
+void() target_position = {};
Modified: trunk/basezym/progsqc/mapentities.qc
===================================================================
--- trunk/basezym/progsqc/mapentities.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/mapentities.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,31 +1,50 @@
-
-void() InitTrigger =
-{
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_TRIGGER;
- setmodel(self, self.model);
- self.modelindex = 0; // we only wanted the box
- self.model = ""; // hide
-};
-
-void() func_ladder_touch =
-{
- if (other.classname != "player")
- return;
- other.ladder_time = time + 0.1;
- other.ladder_entity = self;
-};
-
-void() func_ladder =
-{
- InitTrigger ();
- self.touch = func_ladder_touch;
-};
-
-void() func_water =
-{
- self.solid = SOLID_TRIGGER;
- setmodel (self, self.model); // set size and link into world
- self.touch = func_ladder_touch;
-};
-
+void() InitTrigger =
+{
+// trigger angles are used for one-way touches. An angle of 0 is assumed
+// to mean no restrictions, so use a yaw of 360 instead.
+ if (self.movedir == '0 0 0')
+ if (self.angles != '0 0 0')
+ SetMovedir ();
+ self.solid = SOLID_TRIGGER;
+ setmodel (self, self.model); // set size and link into world, no precision needed
+ self.movetype = MOVETYPE_NONE;
+ self.modelindex = 0;
+ self.model = "";
+};
+
+void() InitSolidBSPTrigger =
+{
+// trigger angles are used for one-way touches. An angle of 0 is assumed
+// to mean no restrictions, so use a yaw of 360 instead.
+ if (self.movedir == '0 0 0')
+ if (self.angles != '0 0 0')
+ SetMovedir ();
+ self.solid = SOLID_BSP;
+ setmodel (self, self.model); // set size and link into world, no precision needed
+ self.movetype = MOVETYPE_PUSH;
+// self.modelindex = 0;
+ self.model = "";
+};
+
+
+void() func_ladder_touch =
+{
+ if (other.classname != "player")
+ return;
+ other.ladder_time = time + 0.1;
+ other.ladder_entity = self;
+};
+
+void() func_ladder =
+{
+ InitTrigger ();
+ self.touch = func_ladder_touch;
+};
+
+void() func_water =
+{
+ self.solid = SOLID_TRIGGER;
+ setmodel (self, self.model); // set size and link into world
+ self.touch = func_ladder_touch;
+};
+
Modified: trunk/basezym/progsqc/player.qc
===================================================================
--- trunk/basezym/progsqc/player.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/player.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,21 +1,6 @@
-
-vector PL_MIN = '-16 -16 -24';
-vector PL_MAX = '16 16 24';
-vector PL_VIEW_OFS = '0 0 22';
-vector PL_WEAPON_OFS = '0 4 16';
-float PL_JUMPSPEED = 175;
-
-float PLAYER_HEALTH_START = 100;
-float PLAYER_HEALTH_MAX = 200;
-float PLAYER_SHIELD_START = 200;
-float PLAYER_SHIELD_MAX = 600;
-float PLAYER_SHIELD_REGENRATE = 20;
-float PLAYER_SHIELD_REGENMAX = 200;
-
-float PLAYER_FALLDAMAGE = 30;
-
.float jumpflag;
.vector oldvelocity;
+.float jetpackacc;
void(float impuls) player_impulse;
@@ -57,7 +42,7 @@
local vector legsframesoffset;
- pc = playerclass_spawn(ACTORTYPE_THEPLAYER, AITYPE_PLAYER, "models/players/spy", ".md3", "player");
+ pc = playerclass_spawn(ACTORTYPE_THEPLAYER, AITYPE_PLAYER, "models/players/soldier", ".md3", "player");
pc.health = PLAYER_HEALTH_START;
pc.max_health = PLAYER_HEALTH_MAX;
pc.armorvalue = PLAYER_SHIELD_START;
@@ -90,7 +75,7 @@
pc.actoranim_LEGS_RUN = '180 9 18' + legsframesoffset;
pc.actoranim_LEGS_BACK = '189 10 15' + legsframesoffset;
pc.actoranim_LEGS_SWIM = '199 10 20' + legsframesoffset;
- pc.actoranim_LEGS_JUMP = '209 9 15' + legsframesoffset;
+ pc.actoranim_LEGS_JUMP = '209 6 15' + legsframesoffset;
pc.actoranim_LEGS_LAND = '215 1 15' + legsframesoffset;
pc.actoranim_LEGS_JUMPB = '218 8 15' + legsframesoffset;
pc.actoranim_LEGS_LANDB = '226 1 15' + legsframesoffset;
@@ -98,71 +83,11 @@
pc.actoranim_LEGS_IDLECR = '236 5 15' + legsframesoffset;
pc.actoranim_LEGS_TURN = '245 7 15' + legsframesoffset;
Inventory_Clear(pc);
- Inventory_GetItemInfo(pc, ITEMTYPE_ASSAULTRAILGUN);
- Inventory_ModifyItem(pc, ITEMTYPE_ASSAULTRAILGUN, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_ASSAULTRAILGUN_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- Inventory_GetItemInfo(pc, ITEMTYPE_CRYLINK);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- Inventory_GetItemInfo(pc, ITEMTYPE_HAGAR);
- Inventory_ModifyItem(pc, ITEMTYPE_HAGAR, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_HAGAR_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- Inventory_GetItemInfo(pc, ITEMTYPE_MINIGUN);
- Inventory_ModifyItem(pc, ITEMTYPE_MINIGUN, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_MINIGUN_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- Inventory_GetItemInfo(pc, ITEMTYPE_RPG);
- Inventory_ModifyItem(pc, ITEMTYPE_RPG, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_RPG_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- Inventory_GetItemInfo(pc, ITEMTYPE_SNIPERRAILGUN);
- Inventory_ModifyItem(pc, ITEMTYPE_SNIPERRAILGUN, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_SNIPERRAILGUN_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
+ Inventory_GetItemInfo(pc, ITEMTYPE_WEAP1);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP1, 1, iteminfo_ammo1max, iteminfo_ammo2max);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP1_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
- /*
- pc = playerclass_spawn(ACTORTYPE_THEPLAYER, AITYPE_PLAYER, "models/players/spy", ".md3", "player");
- pc.health = PLAYER_HEALTH_START;
- pc.max_health = PLAYER_HEALTH_MAX;
- pc.armorvalue = PLAYER_SHIELD_START;
- pc.armortype = 1;
- pc.armorregenrate = PLAYER_SHIELD_REGENRATE;
- pc.armorregenmax = PLAYER_SHIELD_START;
- pc.gibhealth = -100;
- pc.paintake = 20;
- pc.unlimitedinventory = FALSE;
- pc.mass = 90;
- setsize(pc, PL_MIN, PL_MAX);
- pc.view_ofs = PL_VIEW_OFS;
- pc.weapon_ofs = PL_WEAPON_OFS;
- pc.actoranim_BOTH_DEATH1 = '0 30 25';
- pc.actoranim_BOTH_DEAD1 = '29 1 25';
- pc.actoranim_BOTH_DEATH2 = '30 30 25';
- pc.actoranim_BOTH_DEAD2 = '59 1 25';
- pc.actoranim_BOTH_DEATH3 = '60 30 25';
- pc.actoranim_BOTH_DEAD3 = '89 1 25';
- pc.actoranim_TORSO_GESTURE = '90 45 20';
- pc.actoranim_TORSO_ATTACK = '135 6 15';
- pc.actoranim_TORSO_ATTACK2 = '141 6 15';
- pc.actoranim_TORSO_DROP = '147 5 20';
- pc.actoranim_TORSO_RAISE = '151 5 20';
- pc.actoranim_TORSO_STAND = '156 1 15';
- pc.actoranim_TORSO_STAND2 = '157 1 15';
- legsframesoffset = '-1 0 0' * (pc.actoranim_TORSO_STAND2_x + pc.actoranim_TORSO_STAND2_y - pc.actoranim_TORSO_GESTURE_x);
- pc.actoranim_LEGS_WALKCR = '158 10 20' + legsframesoffset;
- pc.actoranim_LEGS_WALK = '168 12 20' + legsframesoffset;
- pc.actoranim_LEGS_RUN = '180 9 18' + legsframesoffset;
- pc.actoranim_LEGS_BACK = '189 10 15' + legsframesoffset;
- pc.actoranim_LEGS_SWIM = '199 10 20' + legsframesoffset;
- pc.actoranim_LEGS_JUMP = '209 9 15' + legsframesoffset;
- pc.actoranim_LEGS_LAND = '215 1 15' + legsframesoffset;
- pc.actoranim_LEGS_JUMPB = '218 8 15' + legsframesoffset;
- pc.actoranim_LEGS_LANDB = '226 1 15' + legsframesoffset;
- pc.actoranim_LEGS_IDLE = '227 5 15' + legsframesoffset;
- pc.actoranim_LEGS_IDLECR = '236 5 15' + legsframesoffset;
- pc.actoranim_LEGS_TURN = '245 7 15' + legsframesoffset;
- Inventory_Clear(pc);
- Inventory_GetItemInfo(pc, ITEMTYPE_ASSAULTRAILGUN);
- Inventory_ModifyItem(pc, ITEMTYPE_ASSAULTRAILGUN, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_ASSAULTRAILGUN_AMMO, iteminfo_ammo1max * 2, 0, 0);
- */
+
pc = playerclass_spawn(ACTORTYPE_LIGHTGUARD, AITYPE_SMARTFELLOW, "models/players/soldier", ".md3", "player");
pc.health = 75;
@@ -205,9 +130,9 @@
pc.actoranim_LEGS_IDLECR = '236 5 15' + legsframesoffset;
pc.actoranim_LEGS_TURN = '245 7 15' + legsframesoffset;
Inventory_Clear(pc);
- Inventory_GetItemInfo(pc, ITEMTYPE_CRYLINK);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
+ Inventory_GetItemInfo(pc, ITEMTYPE_WEAP2);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP2, 1, iteminfo_ammo1max, iteminfo_ammo2max);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP2_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
pc = playerclass_spawn(ACTORTYPE_HEAVYGUARD, AITYPE_SMARTFELLOW, "models/players/soldier", ".md3", "player");
pc.health = PLAYER_HEALTH_START;
@@ -250,9 +175,9 @@
pc.actoranim_LEGS_IDLECR = '236 5 15' + legsframesoffset;
pc.actoranim_LEGS_TURN = '245 7 15' + legsframesoffset;
Inventory_Clear(pc);
- Inventory_GetItemInfo(pc, ITEMTYPE_CRYLINK);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK, 1, iteminfo_ammo1max, iteminfo_ammo2max);
- Inventory_ModifyItem(pc, ITEMTYPE_CRYLINK_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
+ Inventory_GetItemInfo(pc, ITEMTYPE_WEAP2);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP2, 1, iteminfo_ammo1max, iteminfo_ammo2max);
+ Inventory_ModifyItem(pc, ITEMTYPE_WEAP2_AMMO, iteminfo_ammo1inventorymax * 2, 0, 0);
};
entity(float type) playerclass_find =
@@ -562,6 +487,7 @@
{
if (self.jetpackactive)
{
+ self.jetpackacc = 1.5;
sound(self, CHAN_BODY, strcat(self.playerclass.sounddir, "/jetpackstop.wav"), 1, ATTN_NORM);
self.jetpackactive = FALSE;
}
@@ -654,6 +580,8 @@
{
local vector wishvel, wishdir, v;
local float wishspeed, f;
+ local float maxairspeed;
+ local float velo_z;
if (self.movetype == MOVETYPE_NONE)
return;
@@ -720,18 +648,8 @@
self.angles_z = 0;
}
- if (self.flags & FL_WATERJUMP )
+ if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY)
{
- self.velocity_x = self.movedir_x;
- self.velocity_y = self.movedir_y;
- if (time > self.teleport_time || self.waterlevel == 0)
- {
- self.flags = self.flags - (self.flags & FL_WATERJUMP);
- self.teleport_time = 0;
- }
- }
- else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY)
- {
// noclipping or flying
self.velocity = self.velocity * (1 - frametime * sv_friction);
makevectors(self.v_angle);
@@ -749,20 +667,56 @@
self.velocity = self.velocity + wishdir * min(f, sv_accelerate * frametime * wishspeed);
}
}
- else if (self.button5 && self.armorvalue >= 1)
+ else if (self.button5)
{
- local float maxspeed;
- maxspeed = sv_maxspeed;
+ maxairspeed = sv_maxairspeed;
makevectors(self.v_angle_y * '0 1 0');
wishvel = v_forward * self.movement_x + v_right * self.movement_y;
// acceleration
wishdir = normalize(wishvel);
wishspeed = vlen(wishvel);
- if (wishspeed > maxspeed)
- wishspeed = maxspeed;
+ if (wishspeed > maxairspeed)
+ wishspeed = maxairspeed;
+
+ if (wishvel_x > 0 || wishvel_y > 0)
+ {
+ velo_z = sv_gravity * (self.jetpackacc + 3 * (1 - wishspeed / maxairspeed));
+ }
+ else
+ {
+ self.jetpackacc = self.jetpackacc + 0.1;
+ velo_z = sv_gravity * (self.jetpackacc + 3 * (1 - wishspeed / maxairspeed));
+ }
+
if (time >= self.teleport_time)
- self.velocity = self.velocity * (1 - frametime * sv_friction) + (frametime * sv_friction) * wishspeed * 2 * wishdir + (sv_gravity * (1.5 + 3 * (1 - wishspeed / maxspeed)) * '0 0 1') * frametime;
+ self.velocity = self.velocity * (1 - frametime * sv_friction) + (frametime * sv_friction) * wishspeed * 2 * wishdir + (velo_z * '0 0 1') * frametime;
}
+ else if (self.button6)
+ {
+ maxairspeed = sv_maxairspeed;
+ makevectors(self.v_angle_y * '0 1 0');
+ wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+ // acceleration
+ wishdir = normalize(wishvel);
+ wishspeed = vlen(wishvel);
+ if (wishspeed > maxairspeed)
+ wishspeed = maxairspeed;
+
+ if (wishvel_x > 0 || wishvel_y > 0)
+ {
+ velo_z = sv_gravity * ((self.jetpackacc*1.5) + 3 * (1 - wishspeed / maxairspeed));
+ }
+ else
+ {
+ self.jetpackacc = self.jetpackacc + 0.2;
+ velo_z = sv_gravity * ((self.jetpackacc*1.5) + 3 * (1 - wishspeed / maxairspeed));
+ }
+
+ velo_z = velo_z * -1;
+
+ if (time >= self.teleport_time)
+ self.velocity = self.velocity * (1 - frametime * sv_friction) + (frametime * sv_friction) * wishspeed * 2 * wishdir + (velo_z * '0 0 1') * frametime;
+ }
else if (self.waterlevel >= 2)
{
// swimming
@@ -1311,6 +1265,7 @@
{
Inventory_GetItemInfo(self, c);
Inventory_ModifyItem(self, c, iteminfo_quantitymax, iteminfo_ammo1max, iteminfo_ammo2max);
+ bprint(ftos(iteminfo_ammo1max),"\n");
c = c + 1;
}
self.switchweaponitem = Inventory_GetBestWeapon(self);
Modified: trunk/basezym/progsqc/progs.src
===================================================================
--- trunk/basezym/progsqc/progs.src 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/progs.src 2007-06-29 03:29:44 UTC (rev 65)
@@ -5,6 +5,7 @@
gamedefs.qc
util.qc
+jumppads.qc
damage.qc
decors.qc
inventory.qc
Modified: trunk/basezym/progsqc/util.qc
===================================================================
--- trunk/basezym/progsqc/util.qc 2006-10-27 15:07:38 UTC (rev 64)
+++ trunk/basezym/progsqc/util.qc 2007-06-29 03:29:44 UTC (rev 65)
@@ -1,131 +1,450 @@
-
-void() SUB_Null = {};
-void() SUB_Remove = {remove(self);};
-.void() use;
-
-vector(vector m1, vector m2) randompos =
-{
- local vector v;
- v_x = m1_x + random() * (m2_x - m1_x);
- v_y = m1_y + random() * (m2_y - m1_y);
- v_z = m1_z + random() * (m2_z - m1_z);
- return v;
-};
-
-// measurement standards for Zymotic:
-// maps and models are made to a standard of roughly 26 units per meter (8 units per foot), maps are often rounded up to 32 units per 'meter' which doesn't look too bad
-// mass values are in kilograms
-
-.float mass; // in kg
-
-float ANIMTYPE_STAND = 0;
-float ANIMTYPE_WALKFORWARD = 1;
-float ANIMTYPE_WALKBACK = 2;
-float ANIMTYPE_WALKLEFT = 3;
-float ANIMTYPE_WALKRIGHT = 4;
-float ANIMTYPE_RUNFORWARD = 41;
-float ANIMTYPE_RUNBACK = 42;
-float ANIMTYPE_RUNLEFT = 43;
-float ANIMTYPE_RUNRIGHT = 44;
-float ANIMTYPE_DYING = 10;
-float ANIMTYPE_DEAD = 11;
-float ANIMTYPE_GIBBED = 12;
-float ANIMTYPE_JUMP = 20;
-float ANIMTYPE_FALL = 21;
-float ANIMTYPE_IDLE = 30;
-float ANIMTYPE_FIRE1 = 31;
-float ANIMTYPE_FIRE2 = 32;
-float ANIMTYPE_FIRE3 = 33;
-float ANIMTYPE_FIRE4 = 34;
-float ANIMTYPE_RELOAD = 35;
-float ANIMTYPE_LOWER = 36;
-float ANIMTYPE_RAISE = 37;
-
-// .anim_state_x is firstframe, .anim_state_y is endframe, .anim_state_z is framespersecond
-//.vector anim_state;
-//.float anim_starttime;
-// .anim_type is used for weapon logic and other animation driven things, to know what class of animation this is
-.float anim_type;
-.float anim_accumulator;
-.float anim_endframe;
-.float anim_frametime;
-.void(float animdone) anim_framefunc;
-
-//.float weaponstate;
-
-void(float animdone) anim_nullfunc =
-{
-};
-
-.entity actorpart_torso;
-void(entity e) anim_update =
-{
- local float limit;
- local entity oldself;
- oldself = self;
- self = e;
- self.anim_accumulator = self.anim_accumulator + frametime;
- limit = 0;
- while (self.anim_accumulator >= self.anim_frametime && limit < 100)
- {
- limit = limit + 1;
- self.anim_accumulator = self.anim_accumulator - self.anim_frametime;
- if (self.frame + 1 >= self.anim_endframe)
- {
- //if (self.actorpart_torso){dprint("animdone (");dprint(ftos(self.frame + 1));dprint(" >= ");dprint(ftos(self.anim_endframe));dprint("\n");}
- if (self.anim_framefunc)
- self.anim_framefunc(TRUE);
- }
- else
- {
- //if (self.actorpart_torso){dprint("animupdate (");dprint(ftos(self.frame + 1));dprint(" < ");dprint(ftos(self.anim_endframe));dprint("\n");}
- self.frame = self.frame + 1;
- if (self.anim_framefunc)
- self.anim_framefunc(FALSE);
- }
- }
- if (limit >= 100)
- self.anim_accumulator = 0;
- //if (self.owner.actorpart_torso == self) {if (limit){bprint(ftos(limit));bprint(":");bprint(ftos(self.owner.weaponstate));bprint(":");bprint(ftos(self.anim_frametime));bprint("\n");}}
- self = oldself;
-};
-
-void(entity ent, vector newanim, float animtype, void(float animdone) framefunc) anim_start =
-{
- //ent.anim_state = newanim;
- //ent.anim_starttime = time;
- ent.anim_type = animtype;
- ent.anim_framefunc = framefunc;
- ent.frame = newanim_x;
- ent.anim_endframe = newanim_x + newanim_y;
- ent.anim_frametime = 1.0 / newanim_z;
- //if (ent.owner.actorpart_torso == ent) {bprint(ftos(ent.anim_frametime));bprint("(");bprint(vtos(newanim));bprint(")\n");eprint(ent);}
-};
-
-vector(vector forward, vector right) util_anglesfromvectors =
-{
- local vector a;
- local vector oldforward, oldright, oldup;
- oldforward = v_forward;
- oldright = v_right;
- oldup = v_up;
- a = vectoangles(forward);
- makevectors(a_x * '-1 0 0' + a_y * '0 1 0');
- a_z = vectoyaw((right * v_right) * '-1 0 0' + (right * v_up) * '0 1 0');
- v_forward = oldforward;
- v_right = oldright;
- v_up = oldup;
- return a;
-};
-
-void(entity ent) util_detachentity =
-{
- local vector org;
- org = gettaginfo(ent, 0);
- ent.tag_entity = world;
- ent.tag_index = 0;
- ent.angles = util_anglesfromvectors(v_forward, v_right);
- setorigin(ent, org);
-};
-
-
+void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
+void() SUB_CalcMoveDone;
+void() SUB_CalcAngleMoveDone;
+
+void() SUB_Null = {};
+void() SUB_Remove = {remove(self);};
+.void() use;
+
+vector(vector m1, vector m2) randompos =
+{
+ local vector v;
+ v_x = m1_x + random() * (m2_x - m1_x);
+ v_y = m1_y + random() * (m2_y - m1_y);
+ v_z = m1_z + random() * (m2_z - m1_z);
+ return v;
+};
+
+// measurement standards for Zymotic:
+// maps and models are made to a standard of roughly 26 units per meter (8 units per foot), maps are often rounded up to 32 units per 'meter' which doesn't look too bad
+// mass values are in kilograms
+
+.float mass; // in kg
+
+float ANIMTYPE_STAND = 0;
+float ANIMTYPE_WALKFORWARD = 1;
+float ANIMTYPE_WALKBACK = 2;
+float ANIMTYPE_WALKLEFT = 3;
+float ANIMTYPE_WALKRIGHT = 4;
+float ANIMTYPE_RUNFORWARD = 41;
+float ANIMTYPE_RUNBACK = 42;
+float ANIMTYPE_RUNLEFT = 43;
+float ANIMTYPE_RUNRIGHT = 44;
+float ANIMTYPE_DYING = 10;
+float ANIMTYPE_DEAD = 11;
+float ANIMTYPE_GIBBED = 12;
+float ANIMTYPE_JUMP = 20;
+float ANIMTYPE_FALL = 21;
+float ANIMTYPE_IDLE = 30;
+float ANIMTYPE_FIRE1 = 31;
+float ANIMTYPE_FIRE2 = 32;
+float ANIMTYPE_FIRE3 = 33;
+float ANIMTYPE_FIRE4 = 34;
+float ANIMTYPE_RELOAD = 35;
+float ANIMTYPE_LOWER = 36;
+float ANIMTYPE_RAISE = 37;
+
+// .anim_state_x is firstframe, .anim_state_y is endframe, .anim_state_z is framespersecond
+//.vector anim_state;
+//.float anim_starttime;
+// .anim_type is used for weapon logic and other animation driven things, to know what class of animation this is
+.float anim_type;
+.float anim_accumulator;
+.float anim_endframe;
+.float anim_frametime;
+.void(float animdone) anim_framefunc;
+
+//.float weaponstate;
+
+void(float animdone) anim_nullfunc =
+{
+};
+
+.entity actorpart_torso;
+void(entity e) anim_update =
+{
+ local float limit;
+ local entity oldself;
+ oldself = self;
+ self = e;
+ self.anim_accumulator = self.anim_accumulator + frametime;
+ limit = 0;
+ while (self.anim_accumulator >= self.anim_frametime && limit < 100)
+ {
+ limit = limit + 1;
+ self.anim_accumulator = self.anim_accumulator - self.anim_frametime;
+ if (self.frame + 1 >= self.anim_endframe)
+ {
+ //if (self.actorpart_torso){dprint("animdone (");dprint(ftos(self.frame + 1));dprint(" >= ");dprint(ftos(self.anim_endframe));dprint("\n");}
+ if (self.anim_framefunc)
+ self.anim_framefunc(TRUE);
+ }
+ else
+ {
+ //if (self.actorpart_torso){dprint("animupdate (");dprint(ftos(self.frame + 1));dprint(" < ");dprint(ftos(self.anim_endframe));dprint("\n");}
+ self.frame = self.frame + 1;
+ if (self.anim_framefunc)
+ self.anim_framefunc(FALSE);
+ }
+ }
+ if (limit >= 100)
+ self.anim_accumulator = 0;
+ //if (self.owner.actorpart_torso == self) {if (limit){bprint(ftos(limit));bprint(":");bprint(ftos(self.owner.weaponstate));bprint(":");bprint(ftos(self.anim_frametime));bprint("\n");}}
+ self = oldself;
+};
+
+void(entity ent, vector newanim, float animtype, void(float animdone) framefunc) anim_start =
+{
+ //ent.anim_state = newanim;
+ //ent.anim_starttime = time;
+ ent.anim_type = animtype;
+ ent.anim_framefunc = framefunc;
+ ent.frame = newanim_x;
+ ent.anim_endframe = newanim_x + newanim_y;
+ ent.anim_frametime = 1.0 / newanim_z;
+ //if (ent.owner.actorpart_torso == ent) {bprint(ftos(ent.anim_frametime));bprint("(");bprint(vtos(newanim));bprint(")\n");eprint(ent);}
+};
+
+vector(vector forward, vector right) util_anglesfromvectors =
+{
+ local vector a;
+ local vector oldforward, oldright, oldup;
+ oldforward = v_forward;
+ oldright = v_right;
+ oldup = v_up;
+ a = vectoangles(forward);
+ makevectors(a_x * '-1 0 0' + a_y * '0 1 0');
+ a_z = vectoyaw((right * v_right) * '-1 0 0' + (right * v_up) * '0 1 0');
+ v_forward = oldforward;
+ v_right = oldright;
+ v_up = oldup;
+ return a;
+};
+
+void(entity ent) util_detachentity =
+{
+ local vector org;
+ org = gettaginfo(ent, 0);
+ ent.tag_entity = world;
+ ent.tag_index = 0;
+ ent.angles = util_anglesfromvectors(v_forward, v_right);
+ setorigin(ent, org);
+};
+
+/*
+==================
+SUB_VanishOrRemove
+
+Makes client invisible or removes non-client
+==================
+*/
+void SUB_VanishOrRemove (entity ent)
+{
+ if (ent.flags & FL_CLIENT)
+ {
+ // vanish
+ ent.model = "";
+ ent.effects = 0;
+ ent.glow_size = 0;
+ ent.pflags = 0;
+ }
+ else
+ {
+ // remove
+ remove (ent);
+ }
+}
+
+void SUB_SetFade_Think (void)
+{
+ self.think = SUB_SetFade_Think;
+ self.nextthink = self.fade_time;
+ self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
+ if (self.alpha < 0.01)
+ SUB_VanishOrRemove(self);
+ self.alpha = bound(0.01, self.alpha, 1);
+}
+
+/*
+==================
+SUB_SetFade
+
+Fade 'ent' out when time >= 'when'
+==================
+*/
+void SUB_SetFade (entity ent, float when, float fadetime)
+{
+ //if (ent.flags & FL_CLIENT) // && ent.deadflag != DEAD_NO)
+ // return;
+ //ent.alpha = 1;
+ ent.fade_rate = 1/fadetime;
+ ent.fade_time = when;
+ ent.think = SUB_SetFade_Think;
+ ent.nextthink = when;
+}
+
+/*
+=============
+SUB_CalcMove
+
+calculate self.velocity and self.nextthink to reach dest from
+self.origin traveling at speed
+===============
+*/
+void SUB_CalcMoveDone (void)
+{
+ // After moving, set origin to exact final destination
+
+ setorigin (self, self.finaldest);
+ self.velocity = '0 0 0';
+ self.nextthink = -1;
+ if (self.think1)
+ self.think1 ();
+}
+
+void SUB_CalcMove (vector tdest, float tspeed, void() func)
+{
+ vector delta;
+ float traveltime;
+
+ if (!tspeed)
+ objerror ("No speed is defined!");
+
+ self.think1 = func;
+ self.finaldest = tdest;
+ self.think = SUB_CalcMoveDone;
+
+ if (tdest == self.origin)
+ {
+ self.velocity = '0 0 0';
+ self.nextthink = self.ltime + 0.1;
+ return;
+ }
+
+ delta = tdest - self.origin;
+ traveltime = vlen (delta) / tspeed;
+
+ if (traveltime < 0.1)
+ {
+ self.velocity = '0 0 0';
+ self.nextthink = self.ltime + 0.1;
+ return;
+ }
+
+ self.velocity = delta * (1/traveltime); // QuakeC doesn't allow vector/float division
+
+ self.nextthink = self.ltime + traveltime;
+}
+
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeed, void() func)
+{
+ entity oldself;
+
+ oldself = self;
+ self = ent;
+
+ SUB_CalcMove (tdest, tspeed, func);
+
+ self = oldself;
+}
+
+/*
+=============
+SUB_CalcAngleMove
+
+calculate self.avelocity and self.nextthink to reach destangle from
+self.angles rotating
+
+The calling function should make sure self.think is valid
+===============
+*/
+void SUB_CalcAngleMoveDone (void)
+{
+ // After rotating, set angle to exact final angle
+ self.angles = self.finalangle;
+ self.avelocity = '0 0 0';
+ self.nextthink = -1;
+ if (self.think1)
+ self.think1 ();
+}
+
+void SUB_CalcAngleMove (vector destangle, float tspeed, void() func)
+{
+ vector delta;
+ float traveltime;
+
+ if (!tspeed)
+ objerror ("No speed is defined!");
+
+ delta = destangle - self.angles;
+ traveltime = vlen (delta) / tspeed;
+
+ self.avelocity = delta * (1 / traveltime);
+
+ self.think1 = func;
+ self.finalangle = destangle;
+
+ self.think = SUB_CalcAngleMoveDone;
+ self.nextthink = self.ltime + traveltime;
+}
+
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeed, void() func)
+{
+ entity oldself;
+
+ oldself = self;
+ self = ent;
+
+ SUB_CalcAngleMove (destangle, tspeed, func);
+
+ self = oldself;
+}
+
+
+/*
+==================
+PointSound
+
+Play a sound at the given location
+==================
+*/
+void PointSound (vector org, string snd, float vol, float attn)
+{
+ entity speaker;
+
+ speaker = spawn ();
+ setorigin (speaker, org);
+ sound (speaker, CHAN_BODY, snd, vol, attn);
+ remove (speaker);
+}
+
+// Misc
+
+/*
+==================
+traceline_hitcorpse
+
+A version of traceline that must be used by SOLID_SLIDEBOX things that want to hit SOLID_CORPSE things with a trace attack
+==================
+*/
+void traceline_hitcorpse (entity source, vector v1, vector v2, float nomonst, entity forent)
+{
+ float oldsolid;
+
+ oldsolid = source.solid;
+ source.solid = SOLID_BBOX;
+
+ traceline (v1, v2, nomonst, forent);
+
+ source.solid = oldsolid;
+}
+
+/*
+==================
+findbetterlocation
+
+Returns a point at least 12 units away from walls
+(useful for explosion animations, although the blast is performed where it really happened)
+Ripped from DPMod
+==================
+*/
+vector findbetterlocation (vector org, float mindist)
+{
+ vector loc;
+ vector vec;
+ float c;
+
+ vec = mindist * '1 0 0';
+ c = 0;
+ while (c < 6)
+ {
+ traceline (org, org + vec, TRUE, world);
+ vec = vec * -1;
+ if (trace_fraction < 1)
+ {
+ loc = trace_endpos;
+ traceline (loc, loc + vec, TRUE, world);
+ if (trace_fraction >= 1)
+ org = loc + vec;
+ }
+ if (c & 1)
+ {
+ vec_z = vec_y;
+ vec_y = vec_x;
+ vec_x = vec_z;
+ }
+ c = c + 1;
+ }
+
+ return org;
+}
+
+/*
+==================
+crandom
+
+Returns a random number between -1.0 and 1.0
+==================
+*/
+float crandom (void)
+{
+ return 2 * (random () - 0.5);
+}
+
+/*
+==================
+Angc used for animations
+==================
+*/
+
+
+float angc (float a1, float a2)
+{
+ float a;
+
+ while (a1 > 180)
+ a1 = a1 - 360;
+ while (a1 < -179)
+ a1 = a1 + 360;
+
+ while (a2 > 180)
+ a2 = a2 - 360;
+ while (a2 < -179)
+ a2 = a2 + 360;
+
+ a = a1 - a2;
+ while (a > 180)
+ a = a - 360;
+ while (a < -179)
+ a = a + 360;
+
+ return a;
+}
+
+
+void() SetMovedir =
+{
+ if (self.movedir != '0 0 0')
+ self.movedir = normalize(self.movedir);
+ else
+ {
+ if (self.angles == '0 -1 0')
+ self.movedir = '0 0 1';
+ else if (self.angles == '0 -2 0')
+ self.movedir = '0 0 -1';
+ else
+ {
+ makevectors (self.angles);
+ self.movedir = v_forward;
+ }
+ }
+
+ self.angles = '0 0 0';
+};
+
+
+
+float math_mod(float a, float b)
+{
+ return a - (floor(a / b) * b);
+}
\ No newline at end of file
More information about the zymotic-commits
mailing list