From 8ce30c155324054fb88d6de464be611a719e2ab3 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Jun 2016 04:17:42 +1000 Subject: [PATCH] Show a splash when projectiles enter water --- qcsrc/client/weapons/projectile.qc | 9 +++++++++ qcsrc/common/effects/all.inc | 2 ++ qcsrc/common/physics/movetypes/movetypes.qc | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 6261fa842..7a350f792 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -22,6 +22,14 @@ void SUB_Stop(entity this) this.move_movetype = MOVETYPE_NONE; } +void Projectile_ContentsTransition(int prev, int current) +{ENGINE_EVENT(); + if(current == CONTENT_WATER) + { + pointparticles(EFFECT_WATER_SPLASH_SMALL, this.move_origin, this.move_velocity, 1); + } +} + void Projectile_ResetTrail(entity this, vector to) { this.trail_oldorigin = to; @@ -334,6 +342,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) settouch(this, SUB_Stop); this.move_movetype = MOVETYPE_TOSS; this.alphamod = 1; + this.contentstransition = Projectile_ContentsTransition; switch (this.cnt) { diff --git a/qcsrc/common/effects/all.inc b/qcsrc/common/effects/all.inc index 060367a3c..ca1819c63 100644 --- a/qcsrc/common/effects/all.inc +++ b/qcsrc/common/effects/all.inc @@ -239,6 +239,8 @@ EFFECT(1, TR_SLIGHTBLOOD, "TR_SLIGHTBLOOD") EFFECT(1, TR_KNIGHTSPIKE, "TR_KNIGHTSPIKE") EFFECT(1, TR_VORESPIKE, "TR_VORESPIKE") EFFECT(0, TE_SPARK, "TE_SPARK") +EFFECT(0, WATER_SPLASH_SMALL, "water_splash_small") +EFFECT(0, WATER_SPLASH_LARGE, "water_splash_large") EFFECT(1, ROCKETMINSTA_LASER_RED, "rocketminsta_laser_red") EFFECT(1, ROCKETMINSTA_LASER_BLUE, "rocketminsta_laser_blue") diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index eee217200..7f0ae281c 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -256,7 +256,7 @@ bool _Movetype_CheckWater(entity this) // SV_CheckWater { // dprintf("_Movetype_CheckWater(): Original: '%d', New: '%d'\n", this.move_watertype, nativecontents); if(this.contentstransition) - this.contentstransition(this.move_watertype, nativecontents); + WITHSELF(this, this.contentstransition(this.move_watertype, nativecontents)); } this.move_waterlevel = WATERLEVEL_NONE; @@ -298,7 +298,7 @@ void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition { // dprintf("_Movetype_CheckWaterTransition(): Origin: %s, Direct: '%d', Original: '%d', New: '%d'\n", vtos(ent.move_origin), pointcontents(ent.move_origin), ent.move_watertype, contents); if(ent.contentstransition) - ent.contentstransition(ent.move_watertype, contents); + WITHSELF(ent, ent.contentstransition(ent.move_watertype, contents)); } if(contents <= CONTENT_WATER) -- 2.39.2