]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/tracing.qc
Merge branch 'master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / tracing.qc
index 961335de4006c4a65b61ecbb2615a37735dd17c2..755ab59e593e4906319debced03fd205fb16ca8e 100644 (file)
@@ -3,7 +3,7 @@
 // make sure you call makevectors first (FIXME?)
 void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range)
 {
-       float nudge = 1; // added to traceline target and subtracted from result
+       float nudge = 1; // added to traceline target and subtracted from result  TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
        float oldsolid;
        vector vecs, dv;
        oldsolid = ent.dphitcontentsmask;
@@ -59,6 +59,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        // calculate the shotdir from the chosen shotorg
        w_shotdir = normalize(w_shotend - w_shotorg);
 
+       //vector prevdir = w_shotdir;
+       //vector prevorg = w_shotorg;
+       //vector prevend = w_shotend; 
+
        if (antilag)
        if (!ent.cvar_cl_noantilag)
        {
@@ -115,6 +119,9 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
 
        // nudge w_shotend so a trace to w_shotend hits
        w_shotend = w_shotend + normalize(w_shotend - w_shotorg) * nudge;
+       //if(w_shotend != prevend) { printf("SERVER: shotEND differs: %s - %s\n", vtos(w_shotend), vtos(prevend)); }
+       //if(w_shotorg != prevorg) { printf("SERVER: shotORG differs: %s - %s\n", vtos(w_shotorg), vtos(prevorg)); }
+       //if(w_shotdir != prevdir) { printf("SERVER: shotDIR differs: %s - %s\n", vtos(w_shotdir), vtos(prevdir)); }
 }
 
 vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute)
@@ -133,14 +140,9 @@ vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float f
        return outvelocity;
 }
 
-#if 0
-float mspercallsum;
-float mspercallsstyle;
-float mspercallcount;
-#endif
-void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
+void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
 {
-       if(missile.owner == world)
+       if(proj.owner == world)
                error("Unowned missile");
 
        dir = dir + upDir * (pUpSpeed / pSpeed);
@@ -148,27 +150,24 @@ void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float
        pSpeed *= vlen(dir);
        dir = normalize(dir);
 
-#if 0
+       #if 0
        if(autocvar_g_projectiles_spread_style != mspercallsstyle)
        {
                mspercallsum = mspercallcount = 0;
                mspercallsstyle = autocvar_g_projectiles_spread_style;
        }
        mspercallsum -= gettime(GETTIME_HIRES);
-#endif
+       #endif
+       
        dir = W_CalculateSpread(dir, spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
-#if 0
+       
+       #if 0
        mspercallsum += gettime(GETTIME_HIRES);
        mspercallcount += 1;
        print("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
-#endif
-
-       missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, pSpeed * dir, forceAbsolute);
-}
+       #endif
 
-void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) // WEAPONTODO
-{
-       W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread, FALSE);
+       proj.velocity = W_CalculateProjectileVelocity(proj.owner.velocity, pSpeed * dir, forceAbsolute);
 }
 
 
@@ -256,7 +255,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        //explosion = spawn();
 
        // Find all non-hit players the beam passed close by
-       if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX)
+       if(deathtype == WEP_VAPORIZER || deathtype == WEP_VORTEX)
        {
                FOR_EACH_REALCLIENT(msg_entity)
                if(msg_entity != self)
@@ -354,9 +353,13 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
        if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
+       {
                FOR_EACH_PLAYER(pl)
                        if(pl != self)
                                antilag_takeback(pl, time - lag);
+               FOR_EACH_MONSTER(pl)
+                       antilag_takeback(pl, time - lag);
+       }
 
        WarpZone_trace_forent = self;
 
@@ -457,7 +460,11 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
        }
 
        if(lag)
+       {
                FOR_EACH_PLAYER(pl)
                        if(pl != self)
                                antilag_restore(pl);
+               FOR_EACH_MONSTER(pl)
+                       antilag_restore(pl);
+       }
 }