]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
implemented DP_ENT_TRAILEFFECTNUM extension, which allows
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 26 Jun 2011 22:37:13 +0000 (22:37 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 27 Jun 2011 08:08:07 +0000 (10:08 +0200)
self.traileffectnum = particleeffectnum("mycustomeffect") on server
entities, rather than requiring csqc for trailparticles()

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11220 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=5070a71b37b3dde085b45ff86fd36c5bb274a039

cl_main.c
dpdefs/dpextensions.qc
protocol.c
protocol.h
prvm_offsets.h
sv_main.c
svvm_cmds.c

index ab7ec1b3c6cddc665071e858b2d95a71b72d2faf..7372d1d293c74564db165f4c1ff98f206b3edf11 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1261,6 +1261,8 @@ void CL_UpdateNetworkEntityTrail(entity_t *e)
        // do trails
        if (e->render.flags & RENDER_GLOWTRAIL)
                trailtype = EFFECT_TR_GLOWTRAIL;
+       if (e->state_current.traileffectnum)
+               trailtype = e->state_current.traileffectnum;
        // check if a trail is allowed (it is not after a teleport for example)
        if (trailtype && e->persistent.trail_allowed)
        {
@@ -1558,6 +1560,8 @@ void CL_LinkNetworkEntity(entity_t *e)
        // do trail light
        if (e->render.flags & RENDER_GLOWTRAIL)
                trailtype = EFFECT_TR_GLOWTRAIL;
+       if (e->state_current.traileffectnum)
+               trailtype = e->state_current.traileffectnum;
        if (trailtype)
                CL_ParticleTrail(trailtype, 1, origin, origin, vec3_origin, vec3_origin, NULL, e->state_current.glowcolor, true, false, NULL, NULL);
 
index 18226fbb208af2bb9cbbc0126183f9e89426535d..c7d83e3f068a606511d07996a0532841af22bf8b 100644 (file)
@@ -278,6 +278,16 @@ float EF_LOWPRECISION = 4194304;
 //description:
 //controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
 
+//DP_ENT_TRAILEFFECTNUM
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float traileffectnum;
+//description:
+//use a custom effectinfo.txt effect on this entity, assign it like this:
+//self.traileffectnum = particleeffectnum("mycustomeffect");
+//this will do both the dlight and particle trail as described in the effect, basically equivalent to trailparticles() in CSQC but performed on a server entity.
+
 //DP_ENT_VIEWMODEL
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
index 304a2d6155bff858390a52480b0bff035f1e6280..3e384e16fccb0face48c7b49f3087702575e1439 100644 (file)
@@ -29,6 +29,7 @@ entity_state_t defaultstate =
        0,//unsigned short exteriormodelforclient; // ! not shown if first person viewing from this entity, shown in all other cases
        0,//unsigned short nodrawtoclient; // !
        0,//unsigned short drawonlytoclient; // !
+       0,//unsigned short traileffectnum;
        {0,0,0,0},//unsigned short light[4]; // color*256 (0.00 to 255.996), and radius*1
        ACTIVE_NOT,//unsigned char active; // true if a valid state
        0,//unsigned char lightstyle;
@@ -2271,6 +2272,8 @@ void EntityState5_WriteUpdate(int number, const entity_state_t *s, int changedbi
                                MSG_WriteShort(msg, (int)((sv.time - s->framegroupblend[0].start) * 1000.0));
                        }
                }
+               if (bits & E5_TRAILEFFECTNUM)
+                       MSG_WriteShort(msg, s->traileffectnum);
        }
 
        ENTITYSIZEPROFILING_END(msg, s->number);
@@ -2492,6 +2495,8 @@ static void EntityState5_ReadUpdate(entity_state_t *s, int number)
                        break;
                }
        }
+       if (bits & E5_TRAILEFFECTNUM)
+               s->traileffectnum = (unsigned short) MSG_ReadShort();
 
 
        if (developer_networkentities.integer >= 2)
@@ -2592,6 +2597,8 @@ static int EntityState5_DeltaBits(const entity_state_t *o, const entity_state_t
                        bits |= E5_GLOWMOD;
                if (n->flags & RENDER_COMPLEXANIMATION)
                        bits |= E5_COMPLEXANIMATION;
+               if (o->traileffectnum != n->traileffectnum)
+                       bits |= E5_TRAILEFFECTNUM;
        }
        else
                if (o->active == ACTIVE_NETWORK)
index 29d2a88a14e9e665b772bb690cd4ade11b78bb20..c101665d53f93ffb0538ed8a3ac58f0724e36408 100644 (file)
@@ -393,6 +393,7 @@ typedef struct entity_state_s
        unsigned short exteriormodelforclient; // ! not shown if first person viewing from this entity, shown in all other cases
        unsigned short nodrawtoclient; // !
        unsigned short drawonlytoclient; // !
+       unsigned short traileffectnum;
        unsigned short light[4]; // color*256 (0.00 to 255.996), and radius*1
        unsigned char active; // true if a valid state
        unsigned char lightstyle;
@@ -746,8 +747,8 @@ void EntityFrame4_CL_ReadFrame(void);
 // byte type=4 short modelindex byte numbones {short pose6s[6]}
 // see also RENDER_COMPLEXANIMATION
 #define E5_COMPLEXANIMATION (1<<25)
-// unused
-#define E5_UNUSED26 (1<<26)
+// ushort traileffectnum
+#define E5_TRAILEFFECTNUM (1<<26)
 // unused
 #define E5_UNUSED27 (1<<27)
 // unused
index bc69ad2499674426eb14bc0000ef24fe269a8db7..1bd6c5e16f197bc79d1af5b0ffbb59a4d93a3d94 100644 (file)
@@ -353,6 +353,7 @@ PRVM_DECLARE_field(team)
 PRVM_DECLARE_field(teleport_time)
 PRVM_DECLARE_field(think)
 PRVM_DECLARE_field(touch)
+PRVM_DECLARE_field(traileffectnum)
 PRVM_DECLARE_field(use)
 PRVM_DECLARE_field(userwavefunc_param0)
 PRVM_DECLARE_field(userwavefunc_param1)
@@ -672,6 +673,7 @@ PRVM_DECLARE_serverfieldfloat(tag_index)
 PRVM_DECLARE_serverfieldfloat(takedamage)
 PRVM_DECLARE_serverfieldfloat(team)
 PRVM_DECLARE_serverfieldfloat(teleport_time)
+PRVM_DECLARE_serverfieldfloat(traileffectnum)
 PRVM_DECLARE_serverfieldfloat(viewzoom)
 PRVM_DECLARE_serverfieldfloat(waterlevel)
 PRVM_DECLARE_serverfieldfloat(watertype)
index 7a1bf0229cc81d0cd13568a5cc3567b7ec3fa6b6..75255fedd2a9063e15147dee38c912cdefa35d0a 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1240,6 +1240,7 @@ static qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *c
        cs->tagentity = PRVM_serveredictedict(ent, tag_entity);
        cs->tagindex = (unsigned char)PRVM_serveredictfloat(ent, tag_index);
        cs->glowsize = glowsize;
+       cs->traileffectnum = PRVM_serveredictfloat(ent, traileffectnum);
 
        // don't need to init cs->colormod because the defaultstate did that for us
        //cs->colormod[0] = cs->colormod[1] = cs->colormod[2] = 32;
index 243978e6e576c5bfbb5f1ee23420232f5380d7f6..5c7de143dd0a572b4b263273060128f09c967fd6 100644 (file)
@@ -51,6 +51,7 @@ const char *vm_sv_extensions =
 "DP_ENT_GLOWMOD "
 "DP_ENT_LOWPRECISION "
 "DP_ENT_SCALE "
+"DP_ENT_TRAILEFFECTNUM "
 "DP_ENT_VIEWMODEL "
 "DP_GECKO_SUPPORT "
 "DP_GFX_EXTERNALTEXTURES "