]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show a splash when projectiles enter water
authorMario <mario@smbclan.net>
Tue, 14 Jun 2016 18:17:42 +0000 (04:17 +1000)
committerMario <mario@smbclan.net>
Tue, 14 Jun 2016 18:17:42 +0000 (04:17 +1000)
qcsrc/client/weapons/projectile.qc
qcsrc/common/effects/all.inc
qcsrc/common/physics/movetypes/movetypes.qc

index 6261fa842f987773298274395246d7a32f782739..7a350f79256068d3e2cf4533c4de7f6379a7018b 100644 (file)
@@ -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)
                {
index 060367a3c55594b33b46e094196330045bb3f911..ca1819c632b772947a78fb4336d850816304518c 100644 (file)
@@ -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")
index eee217200f7da8baf8015dfae9c87d06516079fb..7f0ae281c57bdcd8a5588827fe48c0c6984e35c8 100644 (file)
@@ -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)