]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
debug code
authorMartin Taibr <taibr.martin@gmail.com>
Thu, 25 Jul 2019 14:25:20 +0000 (16:25 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Thu, 25 Jul 2019 14:25:20 +0000 (16:25 +0200)
qcsrc/server/weapons/tracing.qc

index b84b03f59260dcd434a5cd607684a4100a687d2a..4edb093a7551c41a4c63a915ff5d705ac7cf3147 100644 (file)
@@ -211,6 +211,11 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
 //  Ballistics Tracing
 // ====================
 
+bool autocvar_debug;
+bool autocvar_debug_real;
+bool autocvar_debug_vol = 1;
+bool autocvar_debug_atten;
+bool autocvar_debug_old;
 void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
 {
        vector dir = normalize(end - start);
@@ -271,12 +276,13 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
        });
 
        // spawn a temporary explosion entity for RadiusDamage calls
-       //explosion = spawn();
+       //explosion = spawn(); FIXME kill?
 
        // Find all players the beam passed close by (even those hit)
        float length = vlen(endpoint - start);
        entity pseudoprojectile = NULL;
        FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, {
+               if (autocvar_debug && it.railgunhit) continue;
                // not when spectating the shooter
                if (IS_SPEC(it) && it.enemy == this) continue;
 
@@ -284,13 +290,25 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
                vector beampos = start + dir * bound(0, (it.origin - start) * dir, length);
 
                float f = bound(0, 1 - vlen(beampos - it.origin) / 512, 1);
-               if(f <= 0)
-                       continue;
+               //if(f <= 0)
+               //      continue;
+
+               if (f > 0) {
+                       debug_text_3d(beampos, sprintf("this %s -> it %s | %f", this.netname, it.netname, f));
+                       LOG_INFOF("this %s -> it %s | %f", this.netname, it.netname, f);
+               }
 
                if(!pseudoprojectile)
                        pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
                msg_entity = it;
-               soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE);
+               if (autocvar_debug_old == 2) {
+                       // we want this to be very loud when close but fall off quickly -> using max base volume and high attenuation
+                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASEVOICE, ATTEN_LARGE);
+               }else if (autocvar_debug_old == 1) {
+                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE);
+               } else {
+                       soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * autocvar_debug_vol, autocvar_debug_atten);
+               }
        });
        if(pseudoprojectile)
                delete(pseudoprojectile);