X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_subs.qc;h=ecba3669a389e60df7a3bfdfea89efae2b45fccf;hb=f0e85d42bcc9a3e6b2fa6ea8b825ca2dfc60fb1f;hp=585ac42e085b56852be47ac023d9d11976e92404;hpb=541c234fd442f5857209128fc7a907e406f4be03;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 585ac42e0..ecba3669a 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -1,9 +1,9 @@ #include "g_subs.qh" -#include "_all.qh" #include "antilag.qh" #include "command/common.qh" -#include "../warpzonelib/common.qh" +#include "../lib/warpzone/common.qh" +#include "../common/triggers/subs.qh" spawnfunc(info_null) { @@ -11,50 +11,6 @@ spawnfunc(info_null) // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately. } -void setanim(entity e, vector anim, float looping, float override, float restart) -{ - if (!anim) - return; // no animation was given to us! We can't use this. - - if (anim.x == e.animstate_startframe) - if (anim.y == e.animstate_numframes) - if (anim.z == e.animstate_framerate) - { - if(restart) - { - if(restart > 0) - if(anim.y == 1) // ZYM animation - BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT); - } - else - return; - } - e.animstate_startframe = anim.x; - e.animstate_numframes = anim.y; - e.animstate_framerate = anim.z; - e.animstate_starttime = servertime - 0.1 * serverframetime; // shift it a little bit into the past to prevent float inaccuracy hiccups - e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate; - e.animstate_looping = looping; - e.animstate_override = override; - e.frame = e.animstate_startframe; - e.frame1time = servertime; -} - -void updateanim(entity e) -{ - if (time >= e.animstate_endtime) - { - if (e.animstate_looping) - { - e.animstate_starttime = e.animstate_endtime; - e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate; - } - e.animstate_override = false; - } - e.frame = e.animstate_startframe + bound(0, (time - e.animstate_starttime) * e.animstate_framerate, e.animstate_numframes - 1); - //print(ftos(time), " -> ", ftos(e.frame), "\n"); -} - /* ================== main @@ -62,7 +18,7 @@ main unused but required by the engine ================== */ -void main (void) +void main () { } @@ -79,9 +35,6 @@ Additionally it moves players back into the past before the trace and restores t */ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz) { - entity player; - float oldsolid; - // check whether antilagged traces are enabled if (lag < 0.001) lag = 0; @@ -89,18 +42,18 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, lag = 0; // only antilag for clients // change shooter to SOLID_BBOX so the shot can hit corpses - oldsolid = source.dphitcontentsmask; + int oldsolid = source.dphitcontentsmask; if(source) source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; if (lag) { // take players back into the past - FOR_EACH_PLAYER(player) - if(player != forent) - antilag_takeback(player, time - lag); - FOR_EACH_MONSTER(player) - antilag_takeback(player, time - lag); + FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_takeback(it, time - lag))); + FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA( + if(it != forent) + antilag_takeback(it, time - lag); + )); } // do the trace @@ -112,11 +65,11 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, // restore players to current positions if (lag) { - FOR_EACH_PLAYER(player) - if(player != forent) - antilag_restore(player); - FOR_EACH_MONSTER(player) - antilag_restore(player); + FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_restore(it))); + FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA( + if(it != forent) + antilag_restore(it); + )); } // restore shooter solid type @@ -445,24 +398,24 @@ InitTrigger ================ */ -void SetMovedir() -{SELFPARAM(); - if (self.movedir != '0 0 0') - self.movedir = normalize(self.movedir); +void SetMovedir(entity this) +{ + if(this.movedir != '0 0 0') + this.movedir = normalize(this.movedir); else { - makevectors (self.angles); - self.movedir = v_forward; + makevectors(this.angles); + this.movedir = v_forward; } - self.angles = '0 0 0'; + this.angles = '0 0 0'; } void InitTrigger() {SELFPARAM(); // 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. - SetMovedir (); + SetMovedir(self); self.solid = SOLID_TRIGGER; SetBrushEntityModel(); self.movetype = MOVETYPE_NONE; @@ -474,7 +427,7 @@ void InitSolidBSPTrigger() {SELFPARAM(); // 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. - SetMovedir (); + SetMovedir(self); self.solid = SOLID_BSP; SetBrushEntityModel(); self.movetype = MOVETYPE_NONE; // why was this PUSH? -div0