added back r_speeds2, with masses of information (6 lines high), and made it print...
[xonotic/darkplaces.git] / cl_main.c
index 6b2343e..56d77ab 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -225,7 +225,7 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
        case 4:
                SCR_EndLoadingPlaque ();                // allow normal screen updates
                // LordHavoc: debugging purposes
-               Con_DPrintf("GLQuake texture slots in use: %i : %i : %i texels\n", texture_extension_number, numgltextures, texels);
+               Con_DPrintf("Texture slots in use: %i : %i : %i texels\n", texture_extension_number, numgltextures, texels);
                break;
        }
 }
@@ -288,49 +288,6 @@ void CL_PrintEntities_f (void)
 
 /*
 ===============
-SetPal
-
-Debugging tool, just flashes the screen
-===============
-*/
-void SetPal (int i)
-{
-#if 0
-       static int old;
-       byte    pal[768];
-       int             c;
-       
-       if (i == old)
-               return;
-       old = i;
-
-       if (i==0)
-               VID_SetPalette (host_basepal);
-       else if (i==1)
-       {
-               for (c=0 ; c<768 ; c+=3)
-               {
-                       pal[c] = 0;
-                       pal[c+1] = 255;
-                       pal[c+2] = 0;
-               }
-               VID_SetPalette (pal);
-       }
-       else
-       {
-               for (c=0 ; c<768 ; c+=3)
-               {
-                       pal[c] = 0;
-                       pal[c+1] = 0;
-                       pal[c+2] = 255;
-               }
-               VID_SetPalette (pal);
-       }
-#endif
-}
-
-/*
-===============
 CL_AllocDlight
 
 ===============
@@ -393,7 +350,9 @@ void CL_DecayLights (void)
        {
                if (dl->die < cl.time || !dl->radius)
                        continue;
-               
+
+               c_dlights++; // count every dlight in use
+
                dl->radius -= time*dl->decay;
                if (dl->radius < 0)
                        dl->radius = 0;
@@ -432,7 +391,6 @@ float       CL_LerpPoint (void)
        {
                if (frac < -0.01)
                {
-SetPal(1);
                        cl.time = cl.mtime[1];
 //                             Con_Printf ("low frac\n");
                }
@@ -442,14 +400,11 @@ SetPal(1);
        {
                if (frac > 1.01)
                {
-SetPal(2);
                        cl.time = cl.mtime[0];
 //                             Con_Printf ("high frac\n");
                }
                frac = 1;
        }
-       else
-               SetPal(0);
                
        return frac;
 }
@@ -513,9 +468,31 @@ void CL_RelinkEntities (void)
                if (ent->msgtime != cl.mtime[0])
                {
                        ent->model = NULL;
+                       // LordHavoc: free on the same frame, not the next
+                       if (ent->forcelink)
+                               R_RemoveEfrags (ent);   // just became empty
                        continue;
                }
 
+               // LordHavoc: animation interpolation, note: framegroups partially override this in the renderer
+               /*
+               if (ent->model != ent->lerp_model || ent->lerp_time > cl.time)
+               {
+                       ent->lerp_frame1 = ent->lerp_frame2 = ent->frame;
+                       ent->lerp_time = cl.time;
+                       ent->lerp = 0;
+               }
+               else if (ent->frame != ent->lerp_frame2)
+               {
+                       ent->lerp_frame1 = ent->lerpframe2;
+                       ent->lerp_frame2 = ent->frame;
+                       ent->lerp_time = cl.time;
+                       ent->lerp = 0;
+               }
+               else
+                       ent->lerp = bound(0, (cl.time - ent->lerp_time) * 10.0f, 1);
+               */
+
                VectorCopy (ent->origin, oldorg);
 
                if (ent->forcelink)
@@ -562,8 +539,7 @@ void CL_RelinkEntities (void)
                        AngleVectors (ent->angles, fv, rv, uv);
                         
                        VectorMA (dl->origin, 18, fv, dl->origin);
-                       dl->radius = 200 + (rand()&31);
-                       dl->minlight = 32;
+                       dl->radius = 100 + (rand()&31);
                        dl->die = cl.time + 0.1;
                        dl->color[0] = 1.0;dl->color[1] = 1.0;dl->color[2] = 1.0;
                }
@@ -649,21 +625,12 @@ void CL_RelinkEntities (void)
                {
                        dl = CL_AllocDlight (i);
                        VectorCopy (ent->origin, dl->origin);
-                       dl->dark = ent->glowsize < 0; // darklight
                        dl->radius = ent->glowsize;
-                       if (dl->dark)
-                       {
-                               if (ent->glowtrail) // LordHavoc: all darklights leave black trails
-                                       R_RocketTrail2 (oldorg, ent->origin, 0, ent);
-                               dl->radius = -ent->glowsize;
-                       }
-                       else if (ent->glowtrail) // LordHavoc: customizable glow and trail
-                               R_RocketTrail2 (oldorg, ent->origin, ent->glowcolor, ent);
                        dl->die = cl.time + 0.001;
                        tempcolor = (byte *)&d_8to24table[ent->glowcolor];
                        dl->color[0] = tempcolor[0]*(1.0/255.0);dl->color[1] = tempcolor[1]*(1.0/255.0);dl->color[2] = tempcolor[2]*(1.0/255.0);
                }
-               else if (ent->glowtrail) // LordHavoc: customizable glow and trail
+               if (ent->glowtrail) // LordHavoc: customizable glow and trail
                        R_RocketTrail2 (oldorg, ent->origin, ent->glowcolor, ent);
 
                ent->forcelink = false;
@@ -817,7 +784,6 @@ void CL_PModel_f (void)
 CL_Fog_f
 ======================
 */
-extern float fog_density, fog_red, fog_green, fog_blue;
 void CL_Fog_f (void)
 {
        if (Cmd_Argc () == 1)