]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rsurf.c
Fix loading of external Q1BSP textures. Does not fix skybox. Causes console spam
[xonotic/darkplaces.git] / gl_rsurf.c
index 62d51e3208b79e273e1d3bfe4e3e4d057c890157..1a52a66ca44de9c196c9c64869f0e859aae710f5 100644 (file)
@@ -584,9 +584,9 @@ void R_View_WorldVisibility(qboolean forcenovis)
                                                continue;
                                        if (r_vis_trace.integer)
                                        {
-                                               if (p->tracetime != realtime && R_CanSeeBox(r_vis_trace_samples.value, r_vis_trace_eyejitter.value, r_vis_trace_enlarge.value, r_vis_trace_expand.value, r_vis_trace_pad.value, r_refdef.view.origin, cullmins, cullmaxs))
-                                                       p->tracetime = realtime;
-                                               if (realtime - p->tracetime > r_vis_trace_delay.value)
+                                               if (p->tracetime != host.realtime && R_CanSeeBox(r_vis_trace_samples.value, r_vis_trace_eyejitter.value, r_vis_trace_enlarge.value, r_vis_trace_expand.value, r_vis_trace_pad.value, r_refdef.view.origin, cullmins, cullmaxs))
+                                                       p->tracetime = host.realtime;
+                                               if (host.realtime - p->tracetime > r_vis_trace_delay.value)
                                                        continue;
                                        }
                                        if (leafstackpos >= (int)(sizeof(leafstack) / sizeof(leafstack[0])))
@@ -918,10 +918,12 @@ static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qboo
                                for (leafsurfaceindex = 0;leafsurfaceindex < numleafsurfaces;leafsurfaceindex++)
                                {
                                        surfaceindex = leafsurfaceindices[leafsurfaceindex];
+                                       surface = surfaces + surfaceindex;
+                                       if(!surface->texture)
+                                               continue;       
                                        if (CHECKPVSBIT(info->outsurfacepvs, surfaceindex))
                                                continue;
                                        SETPVSBIT(info->outsurfacepvs, surfaceindex);
-                                       surface = surfaces + surfaceindex;
                                        if (!BoxesOverlap(info->lightmins, info->lightmaxs, surface->mins, surface->maxs))
                                                continue;
                                        addedtris = false;
@@ -1587,8 +1589,8 @@ void GL_Surf_Init(void)
        Cvar_RegisterVariable(&r_vis_trace_surfaces);
        Cvar_RegisterVariable(&r_q3bsp_renderskydepth);
 
-       Cmd_AddCommand(&cmd_client, "r_replacemaptexture", R_ReplaceWorldTexture_f, "override a map texture for testing purposes");
-       Cmd_AddCommand(&cmd_client, "r_listmaptextures", R_ListWorldTextures_f, "list all textures used by the current map");
+       Cmd_AddCommand(CMD_CLIENT, "r_replacemaptexture", R_ReplaceWorldTexture_f, "override a map texture for testing purposes");
+       Cmd_AddCommand(CMD_CLIENT, "r_listmaptextures", R_ListWorldTextures_f, "list all textures used by the current map");
 
        //R_RegisterModule("GL_Surf", gl_surf_start, gl_surf_shutdown, gl_surf_newmap);
 }