From 4942d749e35fa3b5d5759d51bdae689492dd1c17 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 8 Jan 2023 18:30:32 +0100 Subject: [PATCH] Fix decals not appearing when a projectile with 0 size (blaster, crylink, hagar) hits a surface with a small angle. This fix also improves the previous fix for the same issue for hitscan weapons (1db2592) Now the w_backoff factor is 2 for all weapons, except for the hook (-2) whose bomb explodes slightly below the floor --- qcsrc/common/effects/qc/damageeffects.qc | 6 +++++- qcsrc/common/mutators/mutator/overkill/okhmg.qc | 3 +-- qcsrc/common/mutators/mutator/overkill/okmachinegun.qc | 3 +-- qcsrc/common/mutators/mutator/overkill/oknex.qc | 2 +- qcsrc/common/mutators/mutator/overkill/okrpc.qc | 3 +-- qcsrc/common/weapons/weapon/arc.qc | 3 +-- qcsrc/common/weapons/weapon/blaster.qc | 3 +-- qcsrc/common/weapons/weapon/crylink.qc | 3 +-- qcsrc/common/weapons/weapon/devastator.qc | 3 +-- qcsrc/common/weapons/weapon/electro.qc | 3 +-- qcsrc/common/weapons/weapon/fireball.qc | 3 +-- qcsrc/common/weapons/weapon/hagar.qc | 3 +-- qcsrc/common/weapons/weapon/hlac.qc | 3 +-- qcsrc/common/weapons/weapon/hook.qc | 3 +-- qcsrc/common/weapons/weapon/machinegun.qc | 3 +-- qcsrc/common/weapons/weapon/minelayer.qc | 3 +-- qcsrc/common/weapons/weapon/mortar.qc | 3 ++- qcsrc/common/weapons/weapon/rifle.qc | 3 +-- qcsrc/common/weapons/weapon/seeker.qc | 3 +-- qcsrc/common/weapons/weapon/shockwave.qc | 3 +-- qcsrc/common/weapons/weapon/vaporizer.qc | 2 +- qcsrc/common/weapons/weapon/vortex.qc | 2 +- 22 files changed, 27 insertions(+), 39 deletions(-) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 20a335b6b..847a9d340 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -396,8 +396,12 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) w_random = prandom(); vector force_dir = normalize(force); + // this traceline usually starts in solid when a hitscan shot hits a surface with a very small angle + // if so, try another traceline starting further back (may still start in solid but only with extremely small angles) traceline(w_org - force_dir * 16, w_org + force_dir * 16, MOVE_NOMONSTERS, NULL); - if(trace_fraction < 1 && !(hitwep.spawnflags & WEP_TYPE_HITSCAN)) + if(trace_startsolid) + traceline(w_org - force_dir * 40, w_org + force_dir * 16, MOVE_NOMONSTERS, NULL); + if(trace_fraction < 1) w_backoff = trace_plane_normal; else w_backoff = -force_dir; diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qc b/qcsrc/common/mutators/mutator/overkill/okhmg.qc index 1d8c5e87f..0bc9af4be 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qc @@ -149,8 +149,7 @@ METHOD(OverkillHeavyMachineGun, wr_killmessage, Notification(entity thiswep)) METHOD(OverkillHeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index a86cdc519..25a0b454b 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -136,8 +136,7 @@ METHOD(OverkillMachineGun, wr_killmessage, Notification(entity thiswep)) METHOD(OverkillMachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index 85f337140..c1240a45f 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -324,7 +324,7 @@ METHOD(OverkillNex, wr_zoom, bool(entity thiswep, entity actor)) METHOD(OverkillNex, wr_impacteffect, void(entity thiswep, entity actor)) { entity this = actor; - vector org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1); if(!w_issilent) sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/mutators/mutator/overkill/okrpc.qc b/qcsrc/common/mutators/mutator/overkill/okrpc.qc index 4610a0b1d..ccfc399a3 100644 --- a/qcsrc/common/mutators/mutator/overkill/okrpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/okrpc.qc @@ -224,8 +224,7 @@ METHOD(OverkillRocketPropelledChainsaw, wr_killmessage, Notification(entity this METHOD(OverkillRocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 12; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index aa1a637c9..43d7a03a4 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -795,8 +795,7 @@ METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor)) { if(w_deathtype & HITTYPE_SECONDARY) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_ELECTRO_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) { sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTN_NORM); } } diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 6902f4853..874d19639 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -219,8 +219,7 @@ METHOD(OffhandBlaster, offhand_think, void(OffhandBlaster this, entity actor, bo METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); } } diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 86dd8fc92..ae1eae284 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -619,8 +619,7 @@ METHOD(Crylink, wr_killmessage, Notification(entity thiswep)) #ifdef CSQC METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_CRYLINK_IMPACT2, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 9ad68db27..6f428dc6c 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -586,8 +586,7 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep)) METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 12; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 97929c7dd..2c03871ce 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -618,8 +618,7 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep)) METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_ELECTRO_BALLEXPLODE, org2, '0 0 0', 1); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 363b1d694..f7c77c514 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -413,14 +413,13 @@ METHOD(Fireball, wr_killmessage, Notification(entity thiswep)) METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; if(w_deathtype & HITTYPE_SECONDARY) { // firemine goes out silently } else { - org2 = w_org + w_backoff * 16; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_FIREBALL_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM * 0.25); // long range boom diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 82f75f363..a8c12efcc 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -481,8 +481,7 @@ METHOD(Hagar, wr_killmessage, Notification(entity thiswep)) METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) { diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index e4db316af..18dde7440 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -208,8 +208,7 @@ METHOD(HLAC, wr_killmessage, Notification(entity thiswep)) METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index d9e11dc01..278571d1b 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -243,8 +243,7 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep)) METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * -2; pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 62b2a09ea..b05f9f720 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -274,8 +274,7 @@ METHOD(MachineGun, wr_killmessage, Notification(entity thiswep)) METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index b1ccb1b05..d9fb3f8d0 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -494,8 +494,7 @@ METHOD(MineLayer, wr_killmessage, Notification(entity thiswep)) METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 12; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_MINE_EXP, VOL_BASE, ATTN_NORM); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 2152accff..442f88265 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -358,7 +358,8 @@ METHOD(Mortar, wr_killmessage, Notification(entity thiswep)) METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor)) { - pointparticles(EFFECT_GRENADE_EXPLODE, w_org + w_backoff, '0 0 0', 1); + vector org2 = w_org + w_backoff * 2; + pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1); if(!w_issilent) sound(actor, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM); } diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index aa4a98062..df3b537c1 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -199,8 +199,7 @@ METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor)) METHOD(Rifle, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 2; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) { diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index bf57fb9c1..7abb2a43c 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -635,8 +635,7 @@ METHOD(Seeker, wr_killmessage, Notification(entity thiswep)) METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2; - org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_BOUNCE) { if(w_deathtype & HITTYPE_SECONDARY) diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 7863de55e..6c2fd8c93 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -766,8 +766,7 @@ void Net_ReadShockwaveParticle() METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor)) { // handled by Net_ReadShockwaveParticle - //vector org2; - //org2 = w_org + w_backoff * 2; + //vector org2 = w_org + w_backoff * 2; //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); } diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 25aa1b665..b32b3b469 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -354,7 +354,7 @@ METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep)) METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor)) { - vector org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; if(w_deathtype & HITTYPE_SECONDARY) { pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1); diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 5c9ae23a1..4d4e43ec6 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -321,7 +321,7 @@ METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor)) METHOD(Vortex, wr_impacteffect, void(entity thiswep, entity actor)) { entity this = actor; - vector org2 = w_org + w_backoff * 6; + vector org2 = w_org + w_backoff * 2; pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1); if(!w_issilent) sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); -- 2.39.2