]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
the -profilegameonly option now stops profiling in CL_Disconnect to give
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 5 Jan 2008 22:31:55 +0000 (22:31 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 5 Jan 2008 22:31:55 +0000 (22:31 +0000)
better results (especially if playing with it on, rather than just
profiling timedemos)
improved handling of cl.num_dlights

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

cl_main.c

index 02f0bd0e7bf10aada03b84007932073fa5ead93c..3b659c596972031ef6f15a7d8b3f188a90a15895 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -311,6 +311,9 @@ void CL_Disconnect(void)
        if (cls.state == ca_dedicated)
                return;
 
+       if (COM_CheckParm("-profilegameonly"))
+               Sys_AllowProfiling(false);
+
        Curl_Clear_forthismap();
 
        Con_DPrintf("CL_Disconnect\n");
@@ -665,35 +668,19 @@ void CL_AllocLightFlash(entity_render_t *ent, matrix4x4_t *matrix, float radius,
        int i;
        dlight_t *dl;
 
-       /*
-// first look for an exact key match
-       if (ent)
-       {
-               dl = cl.dlights;
-               for (i = 0;i < cl.num_dlights;i++, dl++)
-                       if (dl->ent == ent)
-                               goto dlightsetup;
-       }
-       */
-
 // then look for anything else
        dl = cl.dlights;
-       for (i = 0;i < cl.num_dlights;i++, dl++)
+       for (i = 0;i < cl.max_dlights;i++, dl++)
                if (!dl->radius)
-                       goto dlightsetup;
-       // if we hit the end of the active dlights and found no gaps, add a new one
-       if (i < MAX_DLIGHTS)
-       {
-               cl.num_dlights = i + 1;
-               goto dlightsetup;
-       }
+                       break;
 
        // unable to find one
-       return;
+       if (i == cl.max_dlights)
+               return;
 
-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));
+       cl.num_dlights = max(cl.num_dlights, i + 1);
        Matrix4x4_Normalize(&dl->matrix, matrix);
        dl->ent = ent;
        Matrix4x4_OriginFromMatrix(&dl->matrix, dl->origin);