]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
more q3bsp work (and no it still doesn't work right)
[xonotic/darkplaces.git] / cl_main.c
index eff737868e6636d7dc6f48114f2266bbcab56328..88b134c839f363fd6e8380127db88f3f5a9fc2fc 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -98,6 +98,7 @@ void CL_ClearState(void)
        if (!sv.active)
                Host_ClearMemory ();
 
+       // note: this also gets rid of the entity database
        Mem_EmptyPool(cl_entities_mempool);
 
 // wipe the entire cl structure
@@ -349,7 +350,7 @@ static float CL_LerpPoint(void)
 
        // LordHavoc: lerp in listen games as the server is being capped below the client (usually)
        f = cl.mtime[0] - cl.mtime[1];
-       if (!f || cl_nolerp.integer || cls.timedemo || (sv.active && svs.maxclients == 1))
+       if (!f || cl_nolerp.integer || cls.timedemo || cl.islocalgame)
        {
                cl.time = cl.mtime[0];
                return 1;
@@ -456,22 +457,9 @@ void CL_DecayLights(void)
        float time;
 
        time = cl.time - cl.oldtime;
-
-       dl = cl_dlights;
-       for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
-       {
-               if (!dl->radius)
-                       continue;
-               if (dl->die < cl.time)
-               {
-                       dl->radius = 0;
-                       continue;
-               }
-
-               dl->radius -= time*dl->decay;
-               if (dl->radius < 0)
-                       dl->radius = 0;
-       }
+       for (i = 0, dl = cl_dlights;i < MAX_DLIGHTS;i++, dl++)
+               if (dl->radius)
+                       dl->radius = (cl.time < dl->die) ? max(0, dl->radius - time * dl->decay) : 0;
 }
 
 extern qboolean Nehahrademcompatibility;
@@ -615,7 +603,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                if (e->render.model)
                {
                        Mod_CheckLoaded(e->render.model);
-                       if (e->render.model->type != mod_brush)
+                       if (e->render.model->type == mod_alias || e->render.model->type == mod_sprite)
                                angles[0] = -angles[0];
                        if (e->render.model->flags & EF_ROTATE)
                        {
@@ -722,7 +710,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                if (e->persistent.muzzleflash > 0)
                {
                        Matrix4x4_Transform(&e->render.matrix, muzzleflashorigin, v2);
-                       CL_TraceLine(origin, v2, v, NULL, 0, true, NULL);
+                       CL_TraceLine(origin, v2, v, NULL, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_SKY);
                        CL_AllocDlight(NULL, v, e->persistent.muzzleflash, 1, 1, 1, 0, 0);
                        e->persistent.muzzleflash -= cl.frametime * 1000;
                }
@@ -803,7 +791,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                // as soon as player is known we can call V_CalcRefDef
                if ((e - cl_entities) == cl.viewentity)
                        V_CalcRefdef();
-               if (e->render.model && e->render.model->name[0] == '*' && e->render.model->type == mod_brush)
+               if (e->render.model && e->render.model->name[0] == '*' && e->render.model->brush.TraceBox)
                        cl_brushmodel_entities[cl_num_brushmodel_entities++] = &e->render;
                // don't show entities with no modelindex (note: this still shows
                // entities which have a modelindex that resolved to a NULL model)