]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix a crash on Doombringer duel5.bsp where one of the lights has more than 32768...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 May 2018 06:48:05 +0000 (06:48 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 May 2018 06:48:05 +0000 (06:48 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12412 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c

index cd4c08bb4c6e75f0945ab2ee49dacd5464f49c19..3051aa0bf96ceedd9cac4ad1bd1bc3e9c1797ede 100644 (file)
@@ -1383,7 +1383,12 @@ void R_Q1BSP_CompileShadowMap(entity_render_t *ent, vec3_t relativelightorigin,
        int i;
        if (!model->brush.shadowmesh)
                return;
-       r_shadow_compilingrtlight->static_meshchain_shadow_shadowmap = Mod_ShadowMesh_Begin(r_main_mempool, 32768, 32768, NULL, NULL, NULL, false, false, true);
+       // FIXME: the sidetotals code incorrectly assumes that static_meshchain is
+       // a single mesh - to prevent that from crashing (sideoffsets, sidetotals
+       // exceeding the number of triangles in a single mesh) we have to make sure
+       // that we make only a single mesh - so over-estimate the size of the mesh
+       // to match the model.
+       r_shadow_compilingrtlight->static_meshchain_shadow_shadowmap = Mod_ShadowMesh_Begin(r_main_mempool, model->surfmesh.num_vertices, model->surfmesh.num_triangles, NULL, NULL, NULL, false, false, true);
        R_Shadow_PrepareShadowSides(model->brush.shadowmesh->numtriangles);
        for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
        {