From b3b366070c39f850f483084903d956e586cde2fb Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 13 Feb 2009 20:53:02 +0000 Subject: [PATCH] decal fixes git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5874 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/damage.qc | 74 +++++++++++++++++++++-------------- data/qcsrc/server/g_damage.qc | 5 ++- data/qcsrc/server/w_hook.qc | 1 + 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/data/qcsrc/client/damage.qc b/data/qcsrc/client/damage.qc index 08b9625d9..8896fa5db 100644 --- a/data/qcsrc/client/damage.qc +++ b/data/qcsrc/client/damage.qc @@ -1,6 +1,6 @@ void Ent_DamageInfo() { - float hittype, dmg, rad, edge, thisdmg; + float hittype, dmg, rad, edge, thisdmg, forcemul; vector force, org, thisforce; entity oldself; @@ -16,6 +16,14 @@ void Ent_DamageInfo() edge = ReadByte(); force = decompressShortVector(ReadShort()); + if(rad < 0) + { + rad = -rad; + forcemul = -1; + } + else + forcemul = 1; + for(self = findradius(org, rad); self; self = self.chain) { if(rad) @@ -26,18 +34,18 @@ void Ent_DamageInfo() if(dmg) { thisdmg = dmg + (edge - dmg) * thisdmg; - thisforce = vlen(force) * (thisdmg / dmg) * normalize(self.origin - org); + thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - org); } else { thisdmg = 0; - thisforce = vlen(force) * normalize(self.origin - org); + thisforce = forcemul * vlen(force) * normalize(self.origin - org); } } else { thisdmg = dmg; - thisforce = force; + thisforce = forcemul * force; } if(self.damageforcescale) @@ -70,7 +78,7 @@ void Ent_DamageInfo() r = prandom(); traceline(org - normalize(force) * 16, org + normalize(force) * 16, MOVE_NOMONSTERS, world); - if(trace_fraction < 1) + if(trace_fraction < 1 && hitwep != WEP_NEX && hitwep != WEP_MINSTANEX) backoff = trace_plane_normal; else backoff = -1 * normalize(force); @@ -78,12 +86,13 @@ void Ent_DamageInfo() switch(hitwep) { case WEP_LASER: - org2 = org + backoff * 8; - sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); + org2 = org + backoff * 6; pointparticles(particleeffectnum("laser_impact"), org2, backoff * 1000, 1); + sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); break; case WEP_SHOTGUN: - pointparticles(particleeffectnum("shotgun_impact"), org, backoff * 1000, 1); + org2 = org + backoff * 2; + pointparticles(particleeffectnum("shotgun_impact"), org2, backoff * 1000, 1); if(r < 0.05) sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM); else if(r < 0.1) @@ -92,7 +101,8 @@ void Ent_DamageInfo() sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM); break; case WEP_UZI: - pointparticles(particleeffectnum("machinegun_impact"), org, backoff * 1000, 1); + org2 = org + backoff * 2; + pointparticles(particleeffectnum("machinegun_impact"), org2, backoff * 1000, 1); if(r < 0.05) sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM); else if(r < 0.1) @@ -106,93 +116,96 @@ void Ent_DamageInfo() sound (self, CHAN_PROJECTILE, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM); break; case WEP_ELECTRO: - org2 = org + backoff * 8; + org2 = org + backoff * 6; if(secondary) { - sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM); pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1); + sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM); } else { if(bounce) { // this is sent as "primary bounce" to distinguish it from secondary bounced balls - sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM); pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1); + sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM); } else { - sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM); pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1); + sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM); } } break; case WEP_CRYLINK: + org2 = org + backoff * 2; if(secondary) { + pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1); sound (self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM); - pointparticles(particleeffectnum("crylink_impact"), org, '0 0 0', 1); } else { + pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1); sound (self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM); - pointparticles(particleeffectnum("crylink_impactbig"), org, '0 0 0', 1); } break; case WEP_NEX: + org2 = org + backoff * 6; + pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1); sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); - pointparticles(particleeffectnum("nex_impact"), org - normalize(force) * 6, '0 0 0', 1); break; case WEP_HAGAR: - org2 = org + backoff * 12; + org2 = org + backoff * 6; + pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); if (r<0.15) sound (self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM); else if (r<0.7) sound (self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM); else sound (self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM); - pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); break; case WEP_ROCKET_LAUNCHER: - org2 = org + backoff * 16; - sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); + org2 = org + backoff * 12; pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1); + sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); break; case WEP_PORTO: print("Since when does Porto send DamageInfo?\n"); break; case WEP_MINSTANEX: + org2 = org + backoff * 6; + pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1); sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); - pointparticles(particleeffectnum("nex_impact"), org - normalize(force) * 6, '0 0 0', 1); break; case WEP_HOOK: - org2 = org + backoff * 12; - sound (self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM); + org2 = org + backoff * 2; pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1); + sound (self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM); break; case WEP_SEEKER: - org2 = org + backoff * 12; + org2 = org + backoff * 6; if(secondary) { + pointparticles(particleeffectnum("flac_explode"), org2, '0 0 0', 1); if (r<0.15) sound (self, CHAN_PROJECTILE, "weapons/flacexp1.wav", 1, ATTN_NORM); else if (r<0.7) sound (self, CHAN_PROJECTILE, "weapons/flacexp2.wav", 1, ATTN_NORM); else sound (self, CHAN_PROJECTILE, "weapons/flacexp3.wav", 1, ATTN_NORM); - pointparticles(particleeffectnum("flac_explode"), org2, '0 0 0', 1); } else { if(bounce) { + pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); if (r<0.15) sound (self, CHAN_PROJECTILE, "weapons/tagexp1.wav", 1, ATTN_NORM); else if (r<0.7) sound (self, CHAN_PROJECTILE, "weapons/tagexp2.wav", 1, ATTN_NORM); else sound (self, CHAN_PROJECTILE, "weapons/tagexp3.wav", 1, ATTN_NORM); - pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); } else if(headshot) { @@ -200,23 +213,24 @@ void Ent_DamageInfo() } else { + pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); if (r<0.15) sound (self, CHAN_PROJECTILE, "weapons/seekerexp1.wav", 1, ATTN_NORM); else if (r<0.7) sound (self, CHAN_PROJECTILE, "weapons/seekerexp2.wav", 1, ATTN_NORM); else sound (self, CHAN_PROJECTILE, "weapons/seekerexp3.wav", 1, ATTN_NORM); - pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1); } } break; case WEP_HLAC: - org2 = org + backoff * 12; - sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); + org2 = org + backoff * 6; pointparticles(particleeffectnum("laser_impact"), org2, backoff * 1000, 1); + sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); break; case WEP_CAMPINGRIFLE: - pointparticles(particleeffectnum("machinegun_impact"), org, backoff * 1000, 1); + org2 = org + backoff * 2; + pointparticles(particleeffectnum("machinegun_impact"), org2, backoff * 1000, 1); if(r < 0.2) sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM); else if(r < 0.4) diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index fc5f9c72c..b694c0953 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -958,7 +958,10 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e force = '0 0 -1'; else force = normalize(force); - Damage_DamageInfo(blastorigin, coredamage, edgedamage, rad, forceintensity * force, deathtype); + if(forceintensity >= 0) + Damage_DamageInfo(blastorigin, coredamage, edgedamage, rad, forceintensity * force, deathtype); + else + Damage_DamageInfo(blastorigin, coredamage, edgedamage, -rad, (-forceintensity) * force, deathtype); } targ = findradius (blastorigin, rad); diff --git a/data/qcsrc/server/w_hook.qc b/data/qcsrc/server/w_hook.qc index da0f61311..43dbdebef 100644 --- a/data/qcsrc/server/w_hook.qc +++ b/data/qcsrc/server/w_hook.qc @@ -33,6 +33,7 @@ void W_Hook_Explode2 (void) { self.event_damage = SUB_Null; self.touch = SUB_Null; + self.effects |= EF_NODRAW; self.think = W_Hook_ExplodeThink; self.nextthink = time; -- 2.39.2