]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
beginnings of some proper server list code, commented out for now
[xonotic/darkplaces.git] / cl_main.c
index d64715fa5378b492b7e5c67372b59bb7a054688b..ad2f92c9d5fd362d577f2bb55c4a35bb82c853f6 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -412,7 +412,7 @@ void CL_AllocDlight (entity_render_t *ent, vec3_t org, float radius, float red,
 dlightsetup:
        //Con_Printf("dlight %i : %f %f %f : %f %f %f\n", i, org[0], org[1], org[2], red * radius, green * radius, blue * radius);
        memset (dl, 0, sizeof(*dl));
-       //dl->ent = ent;
+       dl->ent = ent;
        VectorCopy(org, dl->origin);
        dl->radius = radius;
        dl->color[0] = red;
@@ -473,7 +473,7 @@ static void CL_RelinkStaticEntities(void)
 CL_RelinkEntities
 ===============
 */
-static void CL_RelinkNetworkEntities()
+static void CL_RelinkNetworkEntities(void)
 {
        entity_t *ent;
        int i, effects, temp;
@@ -541,11 +541,13 @@ static void CL_RelinkNetworkEntities()
 
                VectorCopy (neworg, ent->persistent.trail_origin);
                // persistent.modelindex will be updated by CL_LerpUpdate
-               if (ent->state_current.modelindex != ent->persistent.modelindex)
+               if (ent->state_current.modelindex != ent->persistent.modelindex || !ent->state_previous.active)
                        VectorCopy(neworg, oldorg);
 
                VectorCopy (neworg, ent->render.origin);
                ent->render.flags = ent->state_current.flags;
+               if (i == cl.viewentity)
+                       ent->render.flags |= RENDER_EXTERIORMODEL;
                ent->render.effects = effects = ent->state_current.effects;
                if (ent->state_current.flags & RENDER_COLORMAPPED)
                        ent->render.colormap = ent->state_current.colormap;
@@ -569,7 +571,19 @@ static void CL_RelinkNetworkEntities()
                if (effects)
                {
                        if (effects & EF_BRIGHTFIELD)
-                               CL_EntityParticles (ent);
+                       {
+                               if (gamemode == GAME_NEXIUZ)
+                               {
+                                       dlightcolor[0] += 100.0f;
+                                       dlightcolor[1] += 200.0f;
+                                       dlightcolor[2] += 400.0f;
+                                       // don't do trail if we have no previous location
+                                       if (ent->state_previous.active)
+                                               CL_RocketTrail (oldorg, neworg, 8, ent);
+                               }
+                               else
+                                       CL_EntityParticles (ent);
+                       }
                        if (effects & EF_MUZZLEFLASH)
                                ent->persistent.muzzleflash = 100.0f;
                        if (effects & EF_DIMLIGHT)
@@ -644,7 +658,7 @@ static void CL_RelinkNetworkEntities()
                        v2[0] = v[0] * 18 + neworg[0];
                        v2[1] = v[1] * 18 + neworg[1];
                        v2[2] = v[2] * 18 + neworg[2] + 16;
-                       CL_TraceLine(neworg, v2, v, NULL, 0, true);
+                       CL_TraceLine(neworg, v2, v, NULL, 0, true, NULL);
 
                        CL_AllocDlight (NULL, v, ent->persistent.muzzleflash, 1, 1, 1, 0, 0);
                        ent->persistent.muzzleflash -= cl.frametime * 1000;
@@ -707,7 +721,7 @@ static void CL_RelinkNetworkEntities()
                {
                        // * 4 for the expansion from 0-255 to 0-1023 range,
                        // / 255 to scale down byte colors
-                       VectorMA(dlightcolor, ent->state_current.glowsize * (4.0f / 255.0f), (qbyte *)&d_8to24table[ent->state_current.glowcolor], dlightcolor);
+                       VectorMA(dlightcolor, ent->state_current.glowsize * (4.0f / 255.0f), (qbyte *)&palette_complete[ent->state_current.glowcolor], dlightcolor);
                }
                // LordHavoc: customizable trail
                if (ent->render.flags & RENDER_GLOWTRAIL)
@@ -717,21 +731,13 @@ static void CL_RelinkNetworkEntities()
                {
                        VectorCopy(neworg, v);
                        // hack to make glowing player light shine on their gun
-                       if (i == cl.viewentity && !chase_active.integer)
+                       if (i == cl.viewentity/* && !chase_active.integer*/)
                                v[2] += 30;
-                       CL_AllocDlight (NULL, v, 1, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0);
+                       CL_AllocDlight (&ent->render, v, 1, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0);
                }
 
-               if (chase_active.integer)
-               {
-                       if (ent->render.flags & RENDER_VIEWMODEL)
-                               continue;
-               }
-               else
-               {
-                       if (i == cl.viewentity || (ent->render.flags & RENDER_EXTERIORMODEL))
-                               continue;
-               }
+               if (chase_active.integer && (ent->render.flags & RENDER_VIEWMODEL))
+                       continue;
 
                // don't show entities with no modelindex (note: this still shows
                // entities which have a modelindex that resolved to a NULL model)
@@ -777,7 +783,7 @@ void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float
        }
 }
 
-static void CL_RelinkEffects()
+static void CL_RelinkEffects(void)
 {
        int i, intframe;
        cl_effect_t *e;
@@ -849,7 +855,7 @@ void CL_RelinkBeams (void)
                // if coming from the player, update the start position
                //if (b->entity == cl.viewentity)
                //      VectorCopy (cl_entities[cl.viewentity].render.origin, b->start);
-               if (b->entity)
+               if (b->entity && cl_entities[b->entity].state_current.active)
                {
                        VectorCopy (cl_entities[b->entity].render.origin, b->start);
                        b->start[2] += 16;