]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rsurf.c
LoadTGA is now more compliant with the TGA spec regarding colormaps (they can be...
[xonotic/darkplaces.git] / gl_rsurf.c
index 6dfb17bc9f245c4a5f6dd62b4143df85751c44d1..e62b5689ae810f1bc84ea6402814d9303bc3cd94 100644 (file)
@@ -272,7 +272,7 @@ void R_Stain (const vec3_t origin, float radius, int cr1, int cg1, int cb1, int
        // look for embedded bmodels
        for (n = 0;n < cl_num_brushmodel_entities;n++)
        {
-               ent = cl_brushmodel_entities[n];
+               ent = &cl_entities[cl_brushmodel_entities[n]].render;
                model = ent->model;
                if (model && model->name[0] == '*')
                {
@@ -1162,7 +1162,7 @@ static void R_DrawSurfaceList(const entity_render_t *ent, texture_t *texture, in
                                                f = 1 - exp(fogdensity/DotProduct(diff, diff));
                                                VectorScale(c, f, c);
                                        }
-                                       if (!surface->lightmaptexture && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+                                       if (!surface->lightmaptexture && surface->groupmesh->data_lightmapcolor4f && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
                                                c[3] = (surface->groupmesh->data_lightmapcolor4f + 4 * surface->num_firstvertex)[i*4+3] * a;
                                        else
                                                c[3] = a;
@@ -1215,7 +1215,7 @@ static void R_DrawSurfaceList(const entity_render_t *ent, texture_t *texture, in
                                        R_Mesh_VertexPointer(vertex3f);
                                        R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
                                        R_Mesh_ColorPointer(varray_color4f);
-                                       if (!surface->lightmaptexture && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+                                       if (!surface->lightmaptexture && surface->groupmesh->data_lightmapcolor4f && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
                                        {
                                                for (i = 0, v = (vertex3f + 3 * surface->num_firstvertex), c = (varray_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
                                                {
@@ -1252,7 +1252,7 @@ static void R_DrawSurfaceList(const entity_render_t *ent, texture_t *texture, in
                                        vertex3f = RSurf_GetVertexPointer(ent, texture, surface, modelorg);
                                        R_Mesh_VertexPointer(vertex3f);
                                        R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
-                                       if (!surface->lightmaptexture && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+                                       if (!surface->lightmaptexture && surface->groupmesh->data_lightmapcolor4f && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
                                        {
                                                R_Mesh_ColorPointer(varray_color4f);
                                                for (i = 0, v = (vertex3f + 3 * surface->num_firstvertex), c = (varray_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
@@ -1309,7 +1309,7 @@ static void R_DrawSurfaceList(const entity_render_t *ent, texture_t *texture, in
                                R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
                                R_Mesh_ColorPointer(varray_color4f);
                                //RSurf_FogPassColors_Vertex3f_Color4f((surface->groupmesh->data_vertex3f + 3 * surface->num_firstvertex), varray_color4f, fogcolor[0], fogcolor[1], fogcolor[2], texture->currentalpha, 1, surface->num_vertices, modelorg);
-                               if (surface->lightmaptexture && !(texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+                               if (!surface->lightmaptexture && surface->groupmesh->data_lightmapcolor4f && (texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
                                {
                                        for (i = 0, v = (vertex3f + 3 * surface->num_firstvertex), c = (varray_color4f + 4 * surface->num_firstvertex);i < surface->num_vertices;i++, v += 3, c += 4)
                                        {