When reallocating CSQC render entity space, make sure existing render edicts referenc...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 16 Dec 2010 06:39:02 +0000 (06:39 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 16 Dec 2010 06:39:02 +0000 (06:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10664 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c

index 26bac77..0d340a8 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -297,6 +297,7 @@ void CL_ExpandEntities(int num)
 
 void CL_ExpandCSQCRenderEntities(int num)
 {
+       int i;
        int oldmaxcsqcrenderentities;
        entity_render_t *oldcsqcrenderentities;
        if (num >= cl.max_csqcrenderentities)
@@ -310,6 +311,9 @@ void CL_ExpandCSQCRenderEntities(int num)
                if (oldcsqcrenderentities)
                {
                        memcpy(cl.csqcrenderentities, oldcsqcrenderentities, oldmaxcsqcrenderentities * sizeof(entity_render_t));
+                       for (i = 0;i < r_refdef.scene.numentities;i++)
+                               if(r_refdef.scene.entities[i] >= oldcsqcrenderentities && r_refdef.scene.entities[i] < (oldcsqcrenderentities + oldmaxcsqcrenderentities))
+                                       r_refdef.scene.entities[i] = cl.csqcrenderentities + (r_refdef.scene.entities[i] - oldcsqcrenderentities);
                        Mem_Free(oldcsqcrenderentities);
                }
        }