]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / gl_rmain.c
index 14d17f723c1997b75a9e4119dacaa1ba03a89d49..8525e1d2bfdda26afe90c6d98a04aecc3384b7cf 100644 (file)
@@ -297,6 +297,7 @@ static void R_BuildNormalizationCube(void)
                                t = (y + 0.5f) * (2.0f / NORMSIZE) - 1.0f;
                                switch(side)
                                {
+                               default:
                                case 0:
                                        v[0] = 1;
                                        v[1] = -t;
@@ -379,7 +380,7 @@ void gl_main_newmap(void)
                if (l >= 0 && !strcmp(entname + l, ".bsp"))
                {
                        strcpy(entname + l, ".ent");
-                       if ((entities = FS_LoadFile(entname, tempmempool, true)))
+                       if ((entities = (char *)FS_LoadFile(entname, tempmempool, true)))
                        {
                                CL_ParseEntityLump(entities);
                                Mem_Free(entities);
@@ -1155,7 +1156,7 @@ float nomodelcolor4f[6*4] =
 
 void R_DrawNoModelCallback(const void *calldata1, int calldata2)
 {
-       const entity_render_t *ent = calldata1;
+       const entity_render_t *ent = (entity_render_t *)calldata1;
        int i;
        float f1, f2, *c, diff[3];
        float color4f[6*4];
@@ -1665,27 +1666,32 @@ void RSurf_SetColorPointer(const entity_render_t *ent, const msurface_t *surface
                        for (i = 0, c = varray_color4f + 4 * surface->num_firstvertex;i < surface->num_vertices;i++, c += 4)
                        {
                                const qbyte *lm = surface->lightmapinfo->samples + (surface->groupmesh->data_lightmapoffsets + surface->num_firstvertex)[i];
-                               float scale = d_lightstylevalue[surface->lightmapinfo->styles[0]] * (1.0f / 32768.0f);
-                               VectorScale(lm, scale, c);
-                               if (surface->lightmapinfo->styles[1] != 255)
+                               if (lm)
                                {
-                                       int size3 = ((surface->lightmapinfo->extents[0]>>4)+1)*((surface->lightmapinfo->extents[1]>>4)+1)*3;
-                                       lm += size3;
-                                       scale = d_lightstylevalue[surface->lightmapinfo->styles[1]] * (1.0f / 32768.0f);
-                                       VectorMA(c, scale, lm, c);
-                                       if (surface->lightmapinfo->styles[2] != 255)
+                                       float scale = d_lightstylevalue[surface->lightmapinfo->styles[0]] * (1.0f / 32768.0f);
+                                       VectorScale(lm, scale, c);
+                                       if (surface->lightmapinfo->styles[1] != 255)
                                        {
+                                               int size3 = ((surface->lightmapinfo->extents[0]>>4)+1)*((surface->lightmapinfo->extents[1]>>4)+1)*3;
                                                lm += size3;
-                                               scale = d_lightstylevalue[surface->lightmapinfo->styles[2]] * (1.0f / 32768.0f);
+                                               scale = d_lightstylevalue[surface->lightmapinfo->styles[1]] * (1.0f / 32768.0f);
                                                VectorMA(c, scale, lm, c);
-                                               if (surface->lightmapinfo->styles[3] != 255)
+                                               if (surface->lightmapinfo->styles[2] != 255)
                                                {
                                                        lm += size3;
-                                                       scale = d_lightstylevalue[surface->lightmapinfo->styles[3]] * (1.0f / 32768.0f);
+                                                       scale = d_lightstylevalue[surface->lightmapinfo->styles[2]] * (1.0f / 32768.0f);
                                                        VectorMA(c, scale, lm, c);
+                                                       if (surface->lightmapinfo->styles[3] != 255)
+                                                       {
+                                                               lm += size3;
+                                                               scale = d_lightstylevalue[surface->lightmapinfo->styles[3]] * (1.0f / 32768.0f);
+                                                               VectorMA(c, scale, lm, c);
+                                                       }
                                                }
                                        }
                                }
+                               else
+                                       VectorClear(c);
                        }
                        rsurface_lightmapcolor4f = varray_color4f;
                }
@@ -2005,7 +2011,7 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text
 
 static void RSurfShader_Transparent_Callback(const void *calldata1, int calldata2)
 {
-       const entity_render_t *ent = calldata1;
+       const entity_render_t *ent = (entity_render_t *)calldata1;
        const msurface_t *surface = ent->model->data_surfaces + calldata2;
        vec3_t modelorg;
        texture_t *texture;