]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rsurf.c
Revert "Initialize console commands and cvars before anything else"
[xonotic/darkplaces.git] / gl_rsurf.c
index 746632b3287a9bb2c86f43766fc121464f17434e..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;
@@ -1338,7 +1340,7 @@ void R_Q1BSP_DrawShadowMap(int side, entity_render_t *ent, const vec3_t relative
        for (modelsurfacelistindex = 0;modelsurfacelistindex < modelnumsurfaces;modelsurfacelistindex++)
        {
                surface = model->data_surfaces + modelsurfacelist[modelsurfacelistindex];
-               if (surfacesides && !(surfacesides[modelsurfacelistindex] && (1 << side)))
+               if (surfacesides && !(surfacesides[modelsurfacelistindex] & (1 << side)))
                        continue;
                rsurface.texture = R_GetCurrentTexture(surface->texture);
                if (rsurface.texture->currentmaterialflags & MATERIALFLAG_NOSHADOW)
@@ -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);
 }