From: havoc Date: Sun, 26 Jun 2011 22:37:13 +0000 (+0000) Subject: implemented DP_ENT_TRAILEFFECTNUM extension, which allows X-Git-Tag: xonotic-v0.6.0~163^2~330 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=5070a71b37b3dde085b45ff86fd36c5bb274a039;hp=bbfa614b656aa345e70174b6fdccd1804ca42fb6 implemented DP_ENT_TRAILEFFECTNUM extension, which allows 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 --- diff --git a/cl_main.c b/cl_main.c index ab7ec1b3..7372d1d2 100644 --- 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); diff --git a/dpdefs/dpextensions.qc b/dpdefs/dpextensions.qc index 18226fbb..c7d83e3f 100644 --- a/dpdefs/dpextensions.qc +++ b/dpdefs/dpextensions.qc @@ -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 diff --git a/protocol.c b/protocol.c index 304a2d61..3e384e16 100644 --- a/protocol.c +++ b/protocol.c @@ -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) diff --git a/protocol.h b/protocol.h index 29d2a88a..c101665d 100644 --- a/protocol.h +++ b/protocol.h @@ -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 diff --git a/prvm_offsets.h b/prvm_offsets.h index bc69ad24..1bd6c5e1 100644 --- a/prvm_offsets.h +++ b/prvm_offsets.h @@ -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) diff --git a/sv_main.c b/sv_main.c index 7a1bf022..75255fed 100644 --- 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; diff --git a/svvm_cmds.c b/svvm_cmds.c index 243978e6..5c7de143 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -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 "