added DP_SV_MODELFLAGS_AS_EFFECTS extension, this adds EF_ROCKET and
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Apr 2007 21:29:59 +0000 (21:29 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Apr 2007 21:29:59 +0000 (21:29 +0000)
friends as effect bits in the protocol, the QC can use these constants
directly or can use the new .modelflags field to set them without float
precision issues caused by the large values, this basically means that
you can make an entity leave a blood trail, or look like a rocket

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7186 d7cf8633-e32d-0410-b094-e92efae38249

13 files changed:
cl_main.c
client.h
csprogs.c
model_alias.c
model_shared.h
model_sprite.c
progsvm.h
protocol.c
protocol.h
prvm_edict.c
server.h
sv_main.c
svvm_cmds.c

index b9d26a0..c001ad4 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -944,17 +944,11 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
                e->render.model = cl.model_precache[e->state_current.modelindex];
        if (e->render.model)
        {
+               // models can set flags such as EF_ROCKET
+               e->render.effects |= e->render.model->effects;
                // if model is alias or this is a tenebrae-like dlight, reverse pitch direction
                if (e->render.model->type == mod_alias)
                        angles[0] = -angles[0];
-               if ((e->render.model->flags & EF_ROTATE) && (!e->state_current.tagentity && !(e->render.flags & RENDER_VIEWMODEL)))
-               {
-                       angles[1] = ANGLEMOD(100*cl.time);
-                       if (cl_itembobheight.value)
-                               origin[2] += (cos(cl.time * cl_itembobspeed.value * (2.0 * M_PI)) + 1.0) * 0.5 * cl_itembobheight.value;
-               }
-               // transfer certain model flags to effects
-               e->render.effects |= e->render.model->flags2 & (EF_FULLBRIGHT | EF_ADDITIVE);
                if ((e->render.effects & EF_SELECTABLE) && cl.cmd.cursor_entitynumber == e->state_current.number)
                        VectorScale(e->render.colormod, 2, e->render.colormod);
        }
@@ -962,6 +956,13 @@ void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean interpolat
        else if (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC)
                angles[0] = -angles[0];
 
+       if ((e->render.effects & EF_ROTATE) && !(e->render.flags & RENDER_VIEWMODEL))
+       {
+               angles[1] = ANGLEMOD(100*cl.time);
+               if (cl_itembobheight.value)
+                       origin[2] += (cos(cl.time * cl_itembobspeed.value * (2.0 * M_PI)) + 1.0) * 0.5 * cl_itembobheight.value;
+       }
+
        // animation lerp
        if (e->render.frame2 == e->state_current.frame)
        {
@@ -1046,7 +1047,7 @@ void CL_UpdateNetworkEntityTrail(entity_t *e)
        // entity is in the world...
        trailtype = EFFECT_NONE;
        // LordHavoc: if the entity has no effects, don't check each
-       if (e->render.effects & (EF_BRIGHTFIELD | EF_FLAME | EF_STARDUST | EF_FLAG1QW | EF_FLAG2QW))
+       if (e->render.effects & (EF_BRIGHTFIELD | EF_FLAME | EF_STARDUST))
        {
                if (e->render.effects & EF_BRIGHTFIELD)
                {
@@ -1059,34 +1060,34 @@ void CL_UpdateNetworkEntityTrail(entity_t *e)
                        CL_ParticleTrail(EFFECT_EF_FLAME, bound(0, cl.time - cl.oldtime, 0.1), origin, origin, vec3_origin, vec3_origin, NULL, 0, false, true);
                if (e->render.effects & EF_STARDUST)
                        CL_ParticleTrail(EFFECT_EF_STARDUST, bound(0, cl.time - cl.oldtime, 0.1), origin, origin, vec3_origin, vec3_origin, NULL, 0, false, true);
-               if (e->render.effects & (EF_FLAG1QW | EF_FLAG2QW))
-               {
-                       // these are only set on player entities
-                       CL_AddQWCTFFlagModel(e, (e->render.effects & EF_FLAG2QW) != 0);
-               }
+       }
+       if (e->render.internaleffects & (INTEF_FLAG1QW | INTEF_FLAG2QW))
+       {
+               // these are only set on player entities
+               CL_AddQWCTFFlagModel(e, (e->render.internaleffects & INTEF_FLAG2QW) != 0);
        }
        // muzzleflash fades over time
        if (e->persistent.muzzleflash > 0)
                e->persistent.muzzleflash -= bound(0, cl.time - cl.oldtime, 0.1) * 20;
-       // LordHavoc: if the model has no flags, don't check each
-       if (e->render.model && e->render.model->flags && !(e->render.flags & RENDER_VIEWMODEL))
+       // LordHavoc: if the entity has no effects, don't check each
+       if (e->render.model && e->render.effects && !(e->render.flags & RENDER_VIEWMODEL))
        {
-               if (e->render.model->flags & EF_GIB)
+               if (e->render.effects & EF_GIB)
                        trailtype = EFFECT_TR_BLOOD;
-               else if (e->render.model->flags & EF_ZOMGIB)
+               else if (e->render.effects & EF_ZOMGIB)
                        trailtype = EFFECT_TR_SLIGHTBLOOD;
-               else if (e->render.model->flags & EF_TRACER)
+               else if (e->render.effects & EF_TRACER)
                        trailtype = EFFECT_TR_WIZSPIKE;
-               else if (e->render.model->flags & EF_TRACER2)
+               else if (e->render.effects & EF_TRACER2)
                        trailtype = EFFECT_TR_KNIGHTSPIKE;
-               else if (e->render.model->flags & EF_ROCKET)
+               else if (e->render.effects & EF_ROCKET)
                        trailtype = EFFECT_TR_ROCKET;
-               else if (e->render.model->flags & EF_GRENADE)
+               else if (e->render.effects & EF_GRENADE)
                {
                        // LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke)
                        trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE;
                }
-               else if (e->render.model->flags & EF_TRACER3)
+               else if (e->render.effects & EF_TRACER3)
                        trailtype = EFFECT_TR_VORESPIKE;
        }
        // do trails
@@ -1207,7 +1208,7 @@ void CL_UpdateViewModel(void)
                        ent->state_current.modelindex = 0;
        }
        ent->state_current.alpha = cl.entities[cl.viewentity].state_current.alpha;
-       ent->state_current.effects = EF_NOSHADOW | (cl.entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_REFLECTIVE | EF_FULLBRIGHT | EF_NODEPTHTEST));
+       ent->state_current.effects = EF_NOSHADOW | (cl.entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_FULLBRIGHT | EF_NODEPTHTEST));
 
        // reset animation interpolation on weaponmodel if model changed
        if (ent->state_previous.modelindex != ent->state_current.modelindex)
@@ -1318,24 +1319,24 @@ void CL_LinkNetworkEntity(entity_t *e)
                R_RTLight_Update(&r_refdef.lights[r_refdef.numlights++], false, &tempmatrix, color, -1, NULL, true, 0, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
        }
        // LordHavoc: if the model has no flags, don't check each
-       if (e->render.model && e->render.model->flags && !(e->render.flags & RENDER_VIEWMODEL))
+       if (e->render.model && e->render.effects && !(e->render.flags & RENDER_VIEWMODEL))
        {
-               if (e->render.model->flags & EF_GIB)
+               if (e->render.effects & EF_GIB)
                        trailtype = EFFECT_TR_BLOOD;
-               else if (e->render.model->flags & EF_ZOMGIB)
+               else if (e->render.effects & EF_ZOMGIB)
                        trailtype = EFFECT_TR_SLIGHTBLOOD;
-               else if (e->render.model->flags & EF_TRACER)
+               else if (e->render.effects & EF_TRACER)
                        trailtype = EFFECT_TR_WIZSPIKE;
-               else if (e->render.model->flags & EF_TRACER2)
+               else if (e->render.effects & EF_TRACER2)
                        trailtype = EFFECT_TR_KNIGHTSPIKE;
-               else if (e->render.model->flags & EF_ROCKET)
+               else if (e->render.effects & EF_ROCKET)
                        trailtype = EFFECT_TR_ROCKET;
-               else if (e->render.model->flags & EF_GRENADE)
+               else if (e->render.effects & EF_GRENADE)
                {
                        // LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke)
                        trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE;
                }
-               else if (e->render.model->flags & EF_TRACER3)
+               else if (e->render.effects & EF_TRACER3)
                        trailtype = EFFECT_TR_VORESPIKE;
        }
        // LordHavoc: customizable glow
index e07384c..8578e8d 100644 (file)
--- a/client.h
+++ b/client.h
@@ -252,6 +252,8 @@ typedef struct entity_render_s
        vec3_t colormap_shirtcolor;
        // light, particles, etc
        int effects;
+       // qw CTF flags and other internal-use-only effect bits
+       int internaleffects;
        // for Alias models
        int skinnum;
        // render flags
index e09fe5f..5a24186 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -128,14 +128,14 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed)
        e->render.colormap = (int)ed->fields.client->colormap;
        e->render.frame = (int)ed->fields.client->frame;
        e->render.skinnum = (int)ed->fields.client->skin;
-       e->render.effects |= e->render.model->flags2 & (EF_FULLBRIGHT | EF_ADDITIVE);
+       e->render.effects |= e->render.model->effects;
        scale = 1;
        renderflags = 0;
        if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.renderflags)) && val->_float)     renderflags = (int)val->_float;
        if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.alpha)) && val->_float)           e->render.alpha = val->_float;
        if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.scale)) && val->_float)           e->render.scale = scale = val->_float;
        if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.colormod)) && VectorLength2(val->vector)) VectorCopy(val->vector, e->render.colormod);
-       if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.effects)) && val->_float) e->render.effects = (int)val->_float;
+       if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.effects)) && val->_float) e->render.effects |= (int)val->_float;
        if((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.tag_entity)) && val->edict)
        {
                int tagentity;
index bae2228..a062180 100644 (file)
@@ -794,7 +794,9 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend)
        BOUNDI(loadmodel->numframes,0,65536);
        loadmodel->synctype = (synctype_t)LittleLong (pinmodel->synctype);
        BOUNDI(loadmodel->synctype,0,2);
-       loadmodel->flags = LittleLong (pinmodel->flags);
+       // convert model flags to EF flags (MF_ROCKET becomes EF_ROCKET, etc)
+       i = LittleLong (pinmodel->flags);
+       loadmodel->effects = ((i & 255) << 24) | (i & 0x00FFFF00);
 
        for (i = 0;i < 3;i++)
        {
@@ -1125,7 +1127,6 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend)
        loadmodel->surfmesh.data_element3i = (int *)data;data += loadmodel->surfmesh.num_triangles * sizeof(int[3]);
        loadmodel->surfmesh.data_neighbor3i = (int *)data;data += loadmodel->surfmesh.num_triangles * sizeof(int[3]);
 
-       loadmodel->flags = 0; // there are no MD2 flags
        loadmodel->synctype = ST_RAND;
 
        // load the skins
@@ -1308,8 +1309,10 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend)
        loadmodel->DrawShadowVolume = R_Q1BSP_DrawShadowVolume;
        loadmodel->DrawLight = R_Q1BSP_DrawLight;
        loadmodel->TraceBox = Mod_MDLMD2MD3_TraceBox;
-       loadmodel->flags = LittleLong(pinmodel->flags);
        loadmodel->synctype = ST_RAND;
+       // convert model flags to EF flags (MF_ROCKET becomes EF_ROCKET, etc)
+       i = LittleLong (pinmodel->flags);
+       loadmodel->effects = ((i & 255) << 24) | (i & 0x00FFFF00);
 
        // set up some global info about the model
        loadmodel->numframes = LittleLong(pinmodel->num_frames);
@@ -1452,7 +1455,6 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend)
                Host_Error ("Mod_ZYMOTICMODEL_Load: only type 1 (skeletal pose) models are currently supported (name = %s)", loadmodel->name);
 
        loadmodel->type = mod_alias;
-       loadmodel->flags = 0; // there are no flags on zym models
        loadmodel->synctype = ST_RAND;
 
        // byteswap header
@@ -1761,7 +1763,6 @@ void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend)
                Host_Error ("Mod_DARKPLACESMODEL_Load: only type 2 (hierarchical skeletal pose) models are currently supported (name = %s)", loadmodel->name);
 
        loadmodel->type = mod_alias;
-       loadmodel->flags = 0; // there are no flags on zym models
        loadmodel->synctype = ST_RAND;
 
        // byteswap header
@@ -2065,7 +2066,6 @@ void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend)
        loadmodel->DrawShadowVolume = R_Q1BSP_DrawShadowVolume;
        loadmodel->DrawLight = R_Q1BSP_DrawLight;
        loadmodel->TraceBox = Mod_MDLMD2MD3_TraceBox;
-       loadmodel->flags = 0; // there are no flags on zym models
        loadmodel->synctype = ST_RAND;
 
        FS_StripExtension(loadmodel->name, animname, sizeof(animname));
index 023bba1..dc1c969 100644 (file)
@@ -569,10 +569,8 @@ typedef struct model_s
        mempool_t               *mempool;
        // all models use textures...
        rtexturepool_t  *texturepool;
-       // flags from the model file
-       int                             flags;
-       // engine calculated flags, ones that can not be set in the file
-       int                             flags2;
+       // EF_* flags (translated from the model file's different flags layout)
+       int                             effects;
        // number of QC accessible frame(group)s in the model
        int                             numframes;
        // number of QC accessible skin(group)s in the model
index 6498e4f..0ab3628 100644 (file)
@@ -217,7 +217,6 @@ void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend)
        datapointer = (unsigned char *)buffer;
 
        loadmodel->type = mod_sprite;
-       loadmodel->flags2 = EF_FULLBRIGHT;
 
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Sprite_Draw;
index e6dcafe..3204ebd 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -185,6 +185,7 @@ typedef struct prvm_prog_fieldoffsets_s
        int items2; // ssqc
        int lerpfrac; // csqc
        int light_lev; // ssqc
+       int modelflags; // ssqc
        int movement; // ssqc
        int nextthink; // common - used by OP_STATE
        int netaddress; // ssqc
index abfdf9f..aa40970 100644 (file)
@@ -35,8 +35,9 @@ entity_state_t defaultstate =
        0,//unsigned char flags;
        0,//unsigned char tagindex;
        {32, 32, 32},//unsigned char colormod[3];
+       0,//unsigned char internaleffects; // INTEF_FLAG1QW and so on
        // padding to a multiple of 8 bytes (to align the double time)
-       {0,0}//unsigned char unused[2]; // !
+       0//unsigned char unused; // !
 };
 
 // LordHavoc: I own protocol ranges 96, 97, 3500-3599
@@ -1804,9 +1805,9 @@ void EntityState5_WriteUpdate(int number, const entity_state_t *s, int changedbi
                        bits |= E5_FRAME16;
                if (bits & E5_EFFECTS)
                {
-                       if (s->effects >= 65536)
+                       if (s->effects & 0xFFFF0000)
                                bits |= E5_EFFECTS32;
-                       else if (s->effects >= 256)
+                       else if (s->effects & 0xFFFFFF00)
                                bits |= E5_EFFECTS16;
                }
                if (bits >= 256)
@@ -2428,43 +2429,43 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int num
 }
 
 
-static int QW_TranslateEffects(int qweffects, int number)
+static void QW_TranslateEffects(entity_state_t *s, int qweffects)
 {
-       int effects = 0;
+       s->effects = 0;
+       s->internaleffects = 0;
        if (qweffects & QW_EF_BRIGHTFIELD)
-               effects |= EF_BRIGHTFIELD;
+               s->effects |= EF_BRIGHTFIELD;
        if (qweffects & QW_EF_MUZZLEFLASH)
-               effects |= EF_MUZZLEFLASH;
+               s->effects |= EF_MUZZLEFLASH;
        if (qweffects & QW_EF_FLAG1)
        {
                // mimic FTEQW's interpretation of EF_FLAG1 as EF_NODRAW on non-player entities
-               if (number > cl.maxclients)
-                       effects |= EF_NODRAW;
+               if (s->number > cl.maxclients)
+                       s->effects |= EF_NODRAW;
                else
-                       effects |= EF_FLAG1QW;
+                       s->internaleffects |= INTEF_FLAG1QW;
        }
        if (qweffects & QW_EF_FLAG2)
        {
                // mimic FTEQW's interpretation of EF_FLAG2 as EF_ADDITIVE on non-player entities
-               if (number > cl.maxclients)
-                       effects |= EF_ADDITIVE;
+               if (s->number > cl.maxclients)
+                       s->effects |= EF_ADDITIVE;
                else
-                       effects |= EF_FLAG2QW;
+                       s->internaleffects |= INTEF_FLAG2QW;
        }
        if (qweffects & QW_EF_RED)
        {
                if (qweffects & QW_EF_BLUE)
-                       effects |= EF_RED | EF_BLUE;
+                       s->effects |= EF_RED | EF_BLUE;
                else
-                       effects |= EF_RED;
+                       s->effects |= EF_RED;
        }
        else if (qweffects & QW_EF_BLUE)
-               effects |= EF_BLUE;
+               s->effects |= EF_BLUE;
        else if (qweffects & QW_EF_BRIGHTLIGHT)
-               effects |= EF_BRIGHTLIGHT;
+               s->effects |= EF_BRIGHTLIGHT;
        else if (qweffects & QW_EF_DIMLIGHT)
-               effects |= EF_DIMLIGHT;
-       return effects;
+               s->effects |= EF_DIMLIGHT;
 }
 
 void EntityStateQW_ReadPlayerUpdate(void)
@@ -2488,6 +2489,7 @@ void EntityStateQW_ReadPlayerUpdate(void)
        s = &ent->state_current;
        *s = defaultstate;
        s->active = true;
+       s->number = enumber;
        s->colormap = enumber;
        playerflags = MSG_ReadShort();
        MSG_ReadVector(s->origin, cls.protocol);
@@ -2540,7 +2542,7 @@ void EntityStateQW_ReadPlayerUpdate(void)
        if (playerflags & QW_PF_SKINNUM)
                s->skin = MSG_ReadByte();
        if (playerflags & QW_PF_EFFECTS)
-               s->effects = QW_TranslateEffects(MSG_ReadByte(), enumber);
+               QW_TranslateEffects(s, MSG_ReadByte());
        if (playerflags & QW_PF_WEAPONFRAME)
                weaponframe = MSG_ReadByte();
        else
@@ -2592,8 +2594,6 @@ void EntityStateQW_ReadPlayerUpdate(void)
        cl.entities_active[enumber] = s->active;
        // set the update time
        s->time = cl.mtime[0] - msec * 0.001; // qw has no clock
-       // fix the number (it gets wiped occasionally by copying from defaultstate)
-       s->number = enumber;
        // check if we need to update the lerp stuff
        if (s->active)
                CL_MoveLerpEntityStates(&cl.entities[enumber]);
@@ -2619,7 +2619,7 @@ static void EntityStateQW_ReadEntityUpdate(entity_state_t *s, int bits)
        if (bits & QW_U_SKIN)
                s->skin = MSG_ReadByte();
        if (bits & QW_U_EFFECTS)
-               s->effects = QW_TranslateEffects(qweffects = MSG_ReadByte(), s->number);
+               QW_TranslateEffects(s, qweffects = MSG_ReadByte());
        if (bits & QW_U_ORIGIN1)
                s->origin[0] = MSG_ReadCoord13i();
        if (bits & QW_U_ANGLE1)
index fd794ce..04faf61 100644 (file)
@@ -31,14 +31,15 @@ int Protocol_NumberForEnum(protocolversion_t p);
 void Protocol_Names(char *buffer, size_t buffersize);
 
 // model effects
-#define        EF_ROCKET       1                       // leave a trail
-#define        EF_GRENADE      2                       // leave a trail
-#define        EF_GIB          4                       // leave a trail
-#define        EF_ROTATE       8                       // rotate (bonus items)
-#define        EF_TRACER       16                      // green split trail
-#define        EF_ZOMGIB       32                      // small blood trail
-#define        EF_TRACER2      64                      // orange split trail + rotate
-#define        EF_TRACER3      128                     // purple trail
+#define        MF_ROCKET       1                       // leave a trail
+#define        MF_GRENADE      2                       // leave a trail
+#define        MF_GIB          4                       // leave a trail
+#define        MF_ROTATE       8                       // rotate (bonus items)
+#define        MF_TRACER       16                      // green split trail
+#define        MF_ZOMGIB       32                      // small blood trail
+#define        MF_TRACER2      64                      // orange split trail + rotate
+#define        MF_TRACER3      128                     // purple trail
+
 // entity effects
 #define        EF_BRIGHTFIELD                  1
 #define        EF_MUZZLEFLASH                  2
@@ -48,21 +49,34 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #define EF_ADDITIVE                            32
 #define EF_BLUE                                        64
 #define EF_RED                                 128
-#define EF_DELTA                               8388608 // LordHavoc: (obsolete) entity is delta compressed to save network bandwidth  (no longer used)
-#define EF_LOWPRECISION                        4194304 // LordHavoc: entity is low precision (integer coordinates) to save network bandwidth
-// effects/model (can be used as model flags or entity effects)
-#define        EF_REFLECTIVE                   256             // LordHavoc: shiny metal objects :)  (not currently supported)
-#define EF_FULLBRIGHT                  512             // LordHavoc: fullbright
-#define EF_FLAME                               1024    // LordHavoc: on fire
-#define EF_STARDUST                            2048    // LordHavoc: showering sparks
-#define EF_NOSHADOW                            4096    // LordHavoc: does not cast a shadow
-#define EF_NODEPTHTEST                 8192    // LordHavoc: shows through walls
-#define EF_SELECTABLE                  16384   // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
-#define EF_DOUBLESIDED                 32768   //[515]: disable cull face for this entity
-
-#define EF_FLAG1QW                             16777216 // internal client use only
-#define EF_FLAG2QW                             33554432 // internal client use only
-#define EF_STEP                                        0x80000000 // internal client use only - present on MOVETYPE_STEP entities, not QC accessible (too many bits)
+#define EF_UNUSED8                             256
+#define EF_FULLBRIGHT                  512                     // LordHavoc: fullbright
+#define EF_FLAME                               1024            // LordHavoc: on fire
+#define EF_STARDUST                            2048            // LordHavoc: showering sparks
+#define EF_NOSHADOW                            4096            // LordHavoc: does not cast a shadow
+#define EF_NODEPTHTEST                 8192            // LordHavoc: shows through walls
+#define EF_SELECTABLE                  16384           // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
+#define EF_DOUBLESIDED                 32768           //[515]: disable cull face for this entity
+#define EF_UNUSED16                            65536
+#define EF_UNUSED17                            131072
+#define EF_UNUSED18                            262144
+#define EF_UNUSED19                            524288
+#define EF_UNUSED20                            1048576
+#define EF_UNUSED21                            2197152
+#define EF_LOWPRECISION                        4194304         // LordHavoc: entity is low precision (integer coordinates) to save network bandwidth  (serverside only)
+#define EF_UNUSED23                            8388608
+#define EF_ROCKET                              16777216        // leave a trail
+#define EF_GRENADE                             33554432        // leave a trail
+#define EF_GIB                                 67108864        // leave a trail
+#define EF_ROTATE                              134217728       // rotate (bonus items)
+#define EF_TRACER                              268435456       // green split trail
+#define EF_ZOMGIB                              536870912       // small blood trail
+#define EF_TRACER2                             1073741824      // orange split trail + rotate
+#define EF_TRACER3                             0x80000000      // purple trail
+
+// internaleffects bits (no overlap with EF_ bits):
+#define INTEF_FLAG1QW                          1
+#define INTEF_FLAG2QW                          2
 
 // flags for the pflags field of entities
 #define PFLAGS_NOSHADOW                        1
@@ -354,8 +368,9 @@ typedef struct entity_state_s
        unsigned char flags;
        unsigned char tagindex;
        unsigned char colormod[3];
+       unsigned char internaleffects; // INTEF_FLAG1QW and so on
        // padding to a multiple of 8 bytes (to align the double time)
-       unsigned char unused[2];
+       unsigned char unused;
 }
 entity_state_t;
 
index 823e6b7..b3cd3f0 100644 (file)
@@ -1360,6 +1360,7 @@ void PRVM_FindOffsets(void)
        prog->fieldoffsets.items2                         = PRVM_ED_FindFieldOffset("items2");
        prog->fieldoffsets.lerpfrac                       = PRVM_ED_FindFieldOffset("lerpfrac");
        prog->fieldoffsets.light_lev                      = PRVM_ED_FindFieldOffset("light_lev");
+       prog->fieldoffsets.modelflags                     = PRVM_ED_FindFieldOffset("modelflags");
        prog->fieldoffsets.movement                       = PRVM_ED_FindFieldOffset("movement");
        prog->fieldoffsets.netaddress                     = PRVM_ED_FindFieldOffset("netaddress");
        prog->fieldoffsets.nextthink                      = PRVM_ED_FindFieldOffset("nextthink");
index 3659328..0eda633 100644 (file)
--- a/server.h
+++ b/server.h
@@ -268,18 +268,6 @@ typedef struct client_s
 #define        FL_WATERJUMP                    2048    // player jumping out of water
 #define        FL_JUMPRELEASED                 4096    // for jump debouncing
 
-// entity effects
-
-#define        EF_BRIGHTFIELD                  1
-#define        EF_MUZZLEFLASH                  2
-#define        EF_BRIGHTLIGHT                  4
-#define        EF_DIMLIGHT                     8
-// added EF_ effects:
-#define        EF_NODRAW                               16
-#define EF_ADDITIVE                            32  // LordHavoc: Additive Rendering
-#define EF_BLUE                                        64
-#define EF_RED                                 128
-
 #define        SPAWNFLAG_NOT_EASY                      256
 #define        SPAWNFLAG_NOT_MEDIUM            512
 #define        SPAWNFLAG_NOT_HARD                      1024
index f019c4d..7b89111 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -734,6 +734,10 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int
        if (PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.fullbright)->_float)
                cs->effects |= EF_FULLBRIGHT;
 
+       val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.modelflags);
+       if (val && val->_float)
+               cs->effects |= ((unsigned int)val->_float & 0xff) << 24;
+
        if (ent->fields.server->movetype == MOVETYPE_STEP)
                cs->flags |= RENDER_STEP;
        if (cs->number != sv_writeentitiestoclient_clentnum && (cs->effects & EF_LOWPRECISION) && cs->origin[0] >= -32768 && cs->origin[1] >= -32768 && cs->origin[2] >= -32768 && cs->origin[0] <= 32767 && cs->origin[1] <= 32767 && cs->origin[2] <= 32767)
@@ -2618,6 +2622,7 @@ prvm_required_field_t reqfields[] =
        {ev_entity, "nodrawtoclient"},
        {ev_entity, "tag_entity"},
        {ev_entity, "viewmodelforclient"},
+       {ev_float, "Version"},
        {ev_float, "alpha"},
        {ev_float, "ammo_cells1"},
        {ev_float, "ammo_lava_nails"},
@@ -2653,8 +2658,8 @@ prvm_required_field_t reqfields[] =
        {ev_float, "idealpitch"},
        {ev_float, "items2"},
        {ev_float, "light_lev"},
+       {ev_float, "modelflags"},
        {ev_float, "pflags"},
-       {ev_string, "netaddress"},
        {ev_float, "ping"},
        {ev_float, "pitch_speed"},
        {ev_float, "pmodel"},
@@ -2663,8 +2668,13 @@ prvm_required_field_t reqfields[] =
        {ev_float, "scale"},
        {ev_float, "style"},
        {ev_float, "tag_index"},
-       {ev_float, "Version"},
        {ev_float, "viewzoom"},
+       {ev_function, "SendEntity"},
+       {ev_function, "contentstransition"}, // DRESK - Support for Entity Contents Transition Event
+       {ev_function, "customizeentityforclient"},
+       {ev_string, "netaddress"},
+       {ev_string, "playermodel"},
+       {ev_string, "playerskin"},
        {ev_vector, "color"},
        {ev_vector, "colormod"},
        {ev_vector, "cursor_screen"},
@@ -2672,12 +2682,6 @@ prvm_required_field_t reqfields[] =
        {ev_vector, "cursor_trace_start"},
        {ev_vector, "movement"},
        {ev_vector, "punchvector"},
-       {ev_string, "playermodel"},
-       {ev_string, "playerskin"},
-       {ev_function, "SendEntity"},
-       {ev_function, "customizeentityforclient"},
-       // DRESK - Support for Entity Contents Transition Event
-       {ev_function, "contentstransition"},
 };
 
 void SV_VM_Setup(void)
index 6a32a38..1f9fe7f 100644 (file)
@@ -96,6 +96,7 @@ char *vm_sv_extensions =
 "DP_SV_DROPCLIENT "
 "DP_SV_EFFECT "
 "DP_SV_ENTITYCONTENTSTRANSITION "
+"DP_SV_MODELFLAGS_AS_EFFECTS "
 "DP_SV_NETADDRESS "
 "DP_SV_NODRAWTOCLIENT "
 "DP_SV_PING "