]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - misc/source/darkplaces-src/dpdefs/progsdefs.qc
Update the darkplaces engine source
[voretournament/voretournament.git] / misc / source / darkplaces-src / dpdefs / progsdefs.qc
index 2904f7db82277257d4ec07833b22a6826d06afc4..912c3ecabe18bee45be837d061a6a388f684376b 100644 (file)
@@ -391,173 +391,8 @@ 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, float damgtype, string dethtype)          th_pain;
-.void()                th_die;
-
-.entity                oldenemy;               // mad at this player before taking damage
-
-.float         speed;
-
-.float lefty;
-
-.float search_time;
-.float attack_state;
-
-float  AS_STRAIGHT             = 1;
-float  AS_SLIDING              = 2;
-float  AS_MELEE                = 3;
-float  AS_MISSILE              = 4;
-
-//
-// player only fields
-//
-//.float               walkframe;
-
-.float                 attack_finished;
-.float         pain_finished;
-
-.float         invincible_finished;
-.float         invisible_finished;
-.float         super_damage_finished;
-.float         radsuit_finished;
-.float         spawnshieldtime;
-
-.float         invincible_time, invincible_sound;
-.float         invisible_time, invisible_sound;
-.float         super_time, super_sound;
-.float         rad_time;
-.float         fly_sound;
-
-//.float               axhitme;
-
-.float         show_hostile;   // set to time+0.2 whenever a client fires a
-                                                       // weapon or takes damage.  Used to alert
-                                                       // monsters that otherwise would let the player go
-.float         jump_flag;              // player jump flag
-.float         swim_flag;              // player swimming sound flag
-.float         air_finished;   // when time > air_finished, start drowning
-.float         bubble_count;   // keeps track of the number of bubbles
-.string                deathtype;              // keeps track of how the player died
-
-//
-// object stuff
-//
-.string                mdl;
-.vector                mangle;                 // angle at start
-
-.vector                oldorigin;              // only used by secret door
-
-.float         t_length, t_width;
-
-
-//
-// doors, etc
-//
-.vector                dest, dest1, dest2;
-.float         wait;                   // time from firing to restarting
-.float         delay;                  // time from activation to firing
-.entity                trigger_field;  // door's trigger entity
-.string                noise4;
-
-//
-// monsters
-//
-.float                 pausetime;
-.entity        movetarget;
-
-
-//
-// doors
-//
-.float         aflag;
-.float         dmg;                    // damage done by door when hit
-
-//
-// misc
-//
-.float         cnt;                    // misc flag
-
-//
-// subs
-//
-.void()                think1;
-//.vector              finaldest, finalangle;
-
-//
-// triggers
-//
-.float         count;                  // for counting triggers
-
-
-//
-// plats / doors / buttons
-//
-.float         lip;
-.float         state;
-.vector                pos1, pos2;             // top and bottom positions
-.float         height;
-
-//
-// sounds
-//
-.float         waitmin, waitmax;
-//.float               distance;
-//.float               volume;
-
-
-
-
 //===========================================================================
 
-
 //
 // builtin functions
 //
@@ -670,524 +505,3 @@ void(entity e) setspawnparms              = #78;          // set parm1... to the
                                                                                                // for coop respawn
 
 //============================================================================
-
-//
-// subs.qc
-//
-void(vector tdest, float tspeed, void() func) SUB_CalcMove;
-void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
-void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
-void()  SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
-void() SUB_Null;
-void() SUB_UseTargets;
-void() SUB_Remove;
-
-//
-//     combat.qc
-//
-
-
-
-float(entity targ, entity inflictor) CanDamage;
-
-
-
-
-
-//void(vector org, entity en, vector dir, float holetype) newbullethole;
-
-
-//void(float msg, vector a) WriteVec =
-//{
-//     WriteCoord(msg, a_x);
-//     WriteCoord(msg, a_y);
-//     WriteCoord(msg, a_z);
-//};
-
-float() crandom =
-{
-       return 2*(random() - 0.5);
-};
-
-vector(vector m1, vector m2) randompos =
-{
-       local vector v;
-       m2 = m2 - m1;
-       v_x = m2_x * random() + m1_x;
-       v_y = m2_y * random() + m1_y;
-       v_z = m2_z * random() + m1_z;
-       return  v;
-};
-
-// LordHavoc: made this a builtin function
-/*
-vector() randomvec =
-{
-       local vector v;
-       do
-       {
-               v_x = random() - 0.5; // scaled up in the return()
-               v_y = random() - 0.5;
-               v_z = random() - 0.5;
-       }
-       while (vlen(v) > 0.25);
-       return(v * 2);
-};
-*/
-
-vector() randomvec2 =
-{
-       local vector v;
-       v_x = random() - 0.5; // scale doesn't matter because it's normalized
-       v_y = random() - 0.5;
-       v_z = random() - 0.5;
-       v = normalize(v);
-       return(v);
-};
-
-vector() randomdirvec =
-{
-       local vector v;
-       do
-       {
-               do
-               {
-                       v_x = random() - 0.5;
-                       v_y = random() - 0.5;
-                       v_z = random() - 0.5;
-               }
-               while (vlen(v) > 0.25);
-       }
-       while (vlen(v) < 0.1);
-       return normalize(v);
-};
-
-/*
-float(float a) sqrt = // now this IS silly (using vlen to do square root)
-{
-       local vector v;
-       v_x = a;
-       return (vlen(v));
-};
-*/
-
-// returns an empty point near the location if it's in a solid
-// (useful for explosions)
-vector (vector org) findbetterlocation =
-{
-       local vector v;
-       local float c;
-       if (pointcontents(org) != CONTENT_SOLID)
-               return org;
-       c = 0;
-       while (c < 20)
-       {
-               c = c + 1;
-// 4.1 to get it to choose +2 occasionally (rather than a 1 in 32768 chance)
-               v_x = org_x + random() * 4.1 - 2;
-               v_y = org_y + random() * 4.1 - 2;
-               v_z = org_z + random() * 4.1 - 2;
-               if (pointcontents(v) != CONTENT_SOLID)
-                       return v;
-       }
-       return org; // failed to find an empty point
-};
-
-// adjusts the entity's origin to move it out of a solid
-// (useful for projectiles with no size, so they explode in open air)
-// note this is mostly useless on entities bigger than that
-// (unless they happen to have their origin on the surface of a wall)
-void (entity e) findbetterlocation2 =
-{
-       local vector v, org;
-       local float c;
-       if (pointcontents(e.origin) != CONTENT_SOLID)
-               return;
-       org = e.origin;
-       c = 0;
-       while (c < 20)
-       {
-               c = c + 1;
-// 4.1 to get it to choose 4 occasionally (rather than a 1 in 32768 chance)
-               v_x = org_x + random() * 4.1 - 2;
-               v_y = org_y + random() * 4.1 - 2;
-               v_z = org_z + random() * 4.1 - 2;
-               if (pointcontents(v) != CONTENT_SOLID)
-               {
-                       setorigin(e, v);
-                       return;
-               }
-       }
-       return; // failed to find an empty point
-};
-
-// returns a point at least 12 units away from walls
-// (useful for explosion animations, although the blast is performed where it really happened)
-vector (vector org) findbetterlocation3 =
-{
-       local vector v2;
-       traceline(org, org - '12 0 0' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '12 0 0' , TRUE, world);if (trace_fraction >= 1) org = v2 + '12 0 0' ;}
-       traceline(org, org - '-12 0 0', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '-12 0 0', TRUE, world);if (trace_fraction >= 1) org = v2 + '-12 0 0';}
-       traceline(org, org - '0 12 0' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 12 0' , TRUE, world);if (trace_fraction >= 1) org = v2 + '0 12 0' ;}
-       traceline(org, org - '0 -12 0', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 -12 0', TRUE, world);if (trace_fraction >= 1) org = v2 + '0 -12 0';}
-       traceline(org, org - '0 0 12' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 0 12' , TRUE, world);if (trace_fraction >= 1) org = v2 + '0 0 12' ;}
-       traceline(org, org - '0 0 -12', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 0 -12', TRUE, world);if (trace_fraction >= 1) org = v2 + '0 0 -12';}
-       return org;
-};
-
-vector (vector org) findbetterlocation4 =
-{
-       local vector v2;
-       traceline(org, org - '5 0 0' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '5 0 0' , TRUE, world);if (trace_fraction >= 1) org = v2 + '5 0 0' ;}
-       traceline(org, org - '-5 0 0', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '-5 0 0', TRUE, world);if (trace_fraction >= 1) org = v2 + '-5 0 0';}
-       traceline(org, org - '0 5 0' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 5 0' , TRUE, world);if (trace_fraction >= 1) org = v2 + '0 5 0' ;}
-       traceline(org, org - '0 -5 0', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 -5 0', TRUE, world);if (trace_fraction >= 1) org = v2 + '0 -5 0';}
-       traceline(org, org - '0 0 5' , TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 0 5' , TRUE, world);if (trace_fraction >= 1) org = v2 + '0 0 5' ;}
-       traceline(org, org - '0 0 -5', TRUE, world);if (trace_fraction < 1) {v2 = trace_endpos;traceline(v2, v2 + '0 0 -5', TRUE, world);if (trace_fraction >= 1) org = v2 + '0 0 -5';}
-       return org;
-};
-
-/*
-void(vector v1, vector v2, vector m1, vector m2) lh_traceagainstbox =
-{
-       local vector b, dir, delta, dironx, dirony, dironz;
-       local float completedist, r;
-       trace_endpos = v2;
-       trace_fraction = 1;
-       if (vlen(v2 - v1) < 0.1) // too short, might do a divide by zero
-               return;
-       // throw out the complete misses
-       if (v1_x <= m1_x) if (v2_x <= m1_x) return;
-       if (v1_x >= m2_x) if (v2_x >= m2_x) return;
-       if (v1_y <= m1_y) if (v2_y <= m1_y) return;
-       if (v1_y >= m2_y) if (v2_y >= m2_y) return;
-       if (v1_z <= m1_z) if (v2_z <= m1_z) return;
-       if (v1_z >= m2_z) if (v2_z >= m2_z) return;
-       // starting inside the box?
-       if (v1_x >= m1_x) if (v1_x < m2_x) if (v1_y >= m1_y) if (v1_y < m2_y) if (v1_z >= m1_z) if (v1_z < m2_z) return;
-       delta = v2 - v1;
-       dir = normalize(delta);
-       completedist = vlen(v2 - v1);
-       if (delta_x < -0.001 || delta_x > 0.001)
-       {
-               dironx_x = 1;if (delta_x < 0) dironx_x = -1;
-               dironx_y = delta_y / delta_x;
-               dironx_z = delta_z / delta_x;
-       }
-       else
-       {
-               dironx_x = 1;if (delta_x < 0) dironx_x = -1;
-               dironx_y = 0;
-               dironx_z = 0;
-       }
-       if (delta_y < -0.001 || delta_y > 0.001)
-       {
-               dirony_x = delta_x / delta_y;
-               dirony_y = 1;if (delta_y < 0) dirony_y = -1;
-               dirony_z = delta_z / delta_y;
-       }
-       else
-       {
-               dirony_x = 0;
-               dirony_y = 1;if (delta_y < 0) dirony_y = -1;
-               dirony_z = 0;
-       }
-       if (delta_z < -0.001 || delta_z > 0.001)
-       {
-               dironz_x = delta_x / delta_z;
-               dironz_y = delta_y / delta_z;
-               dironz_z = 1;if (delta_z < 0) dironz_z = -1;
-       }
-       else
-       {
-               dironz_x = 0;
-               dironz_y = 0;
-               dironz_z = 1;if (delta_z < 0) dironz_z = -1;
-       }
-       b = v1;
-       r = floor(random() * 1000);
-       if (dir_x > 0)
-       {
-               if (b_x < m1_x)
-               {
-                       b = b + dironx * (m1_x - b_x);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       else
-       {
-               if (b_x > m2_x)
-               {
-                       b = b - dironx * (m2_x - b_x);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       trace_endpos = b;
-       if (trace_fraction > 1) trace_fraction = 1;
-       if (dir_y > 0)
-       {
-               if (b_y < m1_y)
-               {
-                       b = b + dirony * (m1_y - b_y);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       else
-       {
-               if (b_y > m2_y)
-               {
-                       b = b - dirony * (m2_y - b_y);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       trace_endpos = b;
-       if (trace_fraction > 1) trace_fraction = 1;
-       if (dir_z > 0)
-       {
-               if (b_z < m1_z)
-               {
-                       b = b + dironz * (m1_z - b_z);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       else
-       {
-               if (b_z > m2_z)
-               {
-                       b = b - dironz * (m2_z - b_z);
-                       trace_fraction = vlen(b - v1) / completedist;
-               }
-       }
-       trace_endpos = b;
-       if (trace_fraction > 1) trace_fraction = 1;
-};
-*/
-
-.float cantrigger;
-
-void(float n) bprintfloat =
-{
-       local string s;
-       s = ftos(n);
-       bprint(s);
-};
-
-void(vector n) bprintvector =
-{
-       local string s;
-       s = vtos(n);
-       bprint(s);
-};
-
-void(float n) dprintfloat =
-{
-       local string s;
-       s = ftos(n);
-       dprint(s);
-};
-
-void(vector n) dprintvector =
-{
-       local string s;
-       s = vtos(n);
-       dprint(s);
-};
-
-string deathstring1, deathstring2, deathstring3, deathstring4;
-
-float DTYPE_OTHER = 0;
-float DTYPE_PLAYER = 1;
-float DTYPE_WORLD = 2;
-float DTYPE_TEAMKILL = 3;
-float DTYPE_SUICIDE = 4;
-
-void(entity targ, entity attacker, string dmsg, float dtype) Obituary_Generic =
-{
-       deathstring1 = targ.netname;
-       deathstring2 = dmsg;
-       deathstring3 = "";
-       deathstring4 = "";
-};
-
-// called by various obit functions to give a generic message for cases they do not handle
-void(entity targ, entity attacker, string dmsg, float dtype) Obituary_Fallback =
-{
-       if (dtype == DTYPE_OTHER)
-       {
-               deathstring1 = targ.netname;
-               deathstring2 = dmsg;
-               deathstring3 = "";
-               deathstring4 = "";
-       }
-       else if (dtype == DTYPE_SUICIDE)
-       {
-               deathstring1 = targ.netname;
-               deathstring2 = " became bored with life";
-               deathstring3 = "";
-               deathstring4 = "";
-       }
-       else if (dtype == DTYPE_PLAYER)
-       {
-               deathstring1 = targ.netname;
-               deathstring2 = " was killed by ";
-               deathstring3 = attacker.netname;
-               deathstring4 = "";
-       }
-       else if (dtype == DTYPE_TEAMKILL)
-       {
-               deathstring1 = targ.netname;
-               deathstring2 = " was mowed down by his teammate ";
-               deathstring3 = attacker.netname;
-               deathstring4 = "";
-       }
-       else if (dtype == DTYPE_WORLD)
-       {
-               deathstring1 = targ.netname;
-               deathstring2 = " died of unknown causes";
-               deathstring3 = "";
-               deathstring4 = "";
-       }
-};
-
-float GAME_QUAKE = 0;
-float GAME_NEXUIZ = 1;
-float game;
-
-float darkmode;
-
-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;
-
-// see modecheck.qc for deathmatch and teamplay settings
-
-// added for Dark Places
-float CHAN_SPEECH             = 5;
-float CHAN_FOOT               = 6;
-float CHAN_WEAPON2            = 7;
-
-// .gravity field added in Quake 1.07 (Scourge of Armagon)
-.float gravity;
-
-.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;
-
-// several counters
-.float count1, count2, count3, count4, count5, count6, cnt1, cnt2;
-
-.void(entity t, entity a, string m, float dtyp) obitfunc1;
-.entity realowner;
-
-float maxclients; // set by worldspawn code
-float numdecors;
-float maxdecors;
-.float createdtime;
-.void() th_gib;
-
-//void(vector org, entity en, vector dir, float splattype, float importance) newbloodsplat;
-void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) genericbleedfunc;
-
-
-
-
-// damage stuff
-
-void(entity targ, entity inflictor, entity attacker, float damage, float bdamage, string dt, float damgtype, vector damgpoint, vector force, void(entity t, entity a, string m, float dtyp) obitfunc) T_Damage;
-void(entity inflictor, entity attacker, float damage, float force, float radius, entity ignore, string dethtype, float damgtype, void(entity t, entity a, string m, float dtyp) obitfunc) T_RadiusDamage;
-
-
-// resistances to 4 kinds of damage:
-.float resist_bullet, resist_explosive, resist_energy, resist_fire, resist_ice, resist_axe;
-// every monster can have resistances
-// note: -1 means immune, as 0.0 can't be used
-
-// kill message
-.string deathtype;
-// copied from .deathtype for the attacker
-// a map entity can gain alot of meaning by
-// adding a kill message in the deathtype key
-// such as ' was chopped to bits'
-// or ' fell into the abyss'
-// if you set a deathtype for a monster
-// in a map key it will override the normal
-// kill message for that monster
-// so you could have some hell knights that
-// say ' was slain by one of the palace guards'
-// and many other ways to add meaning to a map
-.string deathmsg;
-
-.float regenthink; // next time player will regen some health
-.float isdecor;
-.float radiusdamage_amount; // damage counter
-.vector radiusdamage_force; // direction and power of blast kick
-.float radiusdamage_hit; // 1 if it was hit, reset to 0 afterward
-.vector radiusdamage_lasthit; // location
-.float radiusdamage_ownerdamagescale; // if set on inflictor this will scale damage to owner (overriding default of 0.5)
-vector raddamage_lasthit;
-
-.float frozen;
-.float thawtime;
-.float thawedeffects;
-.void() thawedtouch;
-.float thawedmovetype;
-.void() thawedthink;
-.float thawedthinkdelay;
-
-.void() knockedloosefunc; // called when kinetically disturbed
-.float forcescale; // used for damage force calculations (shambler has lower forcescale than player for instance)
-
-// how much bleeding 'matters' to this entity, a percentage between
-// bodydamage (-1 = 0% as 0 doesn't work) and healthdamage (1.0 = 100%)
-// for instance a player is 100% and a zombie is 0% (bleeding doesn't matter)
-.float bleedratio;
-.float(entity e, float healthdamage, float damage, float damgtype, string dethtype) damagemodifier;
-
-.void() th_gib;
-
-.float health; // if this goes below 1 the thing is dead
-.float bodyhealth; // used for gibbing
-.float healthregen; // regenerate this much health per second
-.float healthlostthisframe; // reset by iscreature code each frame
-
-// adjustable monster damage settings
-float monsterdamagescale;
-float monsterresistancescale;
-// adjustable player damage settings
-float playerdamagescale;
-
-void(entity targ, entity attacker, string dmsg, float dtype, void(entity t, entity a, string m, float dtyp) obitfunc) ClientObituary;
-
-void() monster_death_use;