Browse Source

ref_soft: Fix cache flush on reconnect, fix division by zero in decals

pull/2/head
mittorn 6 years ago
parent
commit
320a3b0834
  1. 3
      r_local.h
  2. 6
      r_main.c
  3. 2
      r_misc.c
  4. 12
      r_surf.c

3
r_local.h

@ -293,6 +293,7 @@ typedef struct @@ -293,6 +293,7 @@ typedef struct
vec3_t modelorg; // relative to viewpoint
qboolean fCustomSkybox;
char mapname[MAX_STRING];
} gl_globals_t;
typedef struct
@ -1247,7 +1248,7 @@ void R_ScanEdges (void); @@ -1247,7 +1248,7 @@ void R_ScanEdges (void);
//
// r_surf.c
//
void D_FlushCaches( qboolean newmap );
void D_FlushCaches( void );
//
// r_draw.c

6
r_main.c

@ -1671,7 +1671,7 @@ void R_BeginFrame( qboolean clearScene ) @@ -1671,7 +1671,7 @@ void R_BeginFrame( qboolean clearScene )
// glConfig.softwareGammaUpdate = true;
// GL_RebuildLightmaps();
// glConfig.softwareGammaUpdate = false;
D_FlushCaches( false );
D_FlushCaches( );
// next frame will be restored gamma
SetBits( vid_brightness->flags, FCVAR_CHANGED );
@ -1682,7 +1682,7 @@ void R_BeginFrame( qboolean clearScene ) @@ -1682,7 +1682,7 @@ void R_BeginFrame( qboolean clearScene )
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
//glConfig.softwareGammaUpdate = true;
// GL_RebuildLightmaps();
D_FlushCaches( false );
D_FlushCaches( );
//glConfig.softwareGammaUpdate = false;
// next frame will be restored gamma
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
@ -1833,7 +1833,7 @@ void R_NewMap (void) @@ -1833,7 +1833,7 @@ void R_NewMap (void)
R_ClearDecals(); // clear all level decals
R_StudioResetPlayerModels();
D_FlushCaches( true );
D_FlushCaches();
r_cnumsurfs = sw_maxsurfs->value;

2
r_misc.c

@ -318,7 +318,7 @@ void R_SetupFrameQ (void) @@ -318,7 +318,7 @@ void R_SetupFrameQ (void)
if (r_fullbright->flags & FCVAR_CHANGED)
{
r_fullbright->flags &= ~FCVAR_CHANGED;
D_FlushCaches( false ); // so all lighting changes
D_FlushCaches( ); // so all lighting changes
}
//tr.framecount++;

12
r_surf.c

@ -806,7 +806,7 @@ void R_InitCaches (void) @@ -806,7 +806,7 @@ void R_InitCaches (void)
sc_size = size;
if( sc_base )
{
D_FlushCaches( false );
D_FlushCaches( );
Mem_Free( sc_base );
}
sc_base = (surfcache_t *)Mem_Calloc(r_temppool,size);
@ -823,10 +823,12 @@ void R_InitCaches (void) @@ -823,10 +823,12 @@ void R_InitCaches (void)
D_FlushCaches
==================
*/
void D_FlushCaches( qboolean newmap )
void D_FlushCaches( void )
{
surfcache_t *c;
model_t *world = WORLDMODEL;
qboolean newmap = !world || !Q_strcmp( tr.mapname, WORLDMODEL->name );
// if newmap, surfaces already freed
if( !newmap )
{
@ -836,6 +838,8 @@ void D_FlushCaches( qboolean newmap ) @@ -836,6 +838,8 @@ void D_FlushCaches( qboolean newmap )
*c->owner = NULL;
}
}
else
Q_strncpy( tr.mapname, WORLDMODEL->name, MAX_STRING );
sc_rover = sc_base;
sc_base->next = NULL;
@ -1040,7 +1044,7 @@ void R_DrawSurfaceDecals() @@ -1040,7 +1044,7 @@ void R_DrawSurfaceDecals()
if( t2 > tex->height )
t2 = tex->height;
if( !tex->pixels[0] || s1 >= s2 || t1 >= t2 )
if( !tex->pixels[0] || s1 >= s2 || t1 >= t2 || !w )
continue;
if( tex->alpha_pixels )

Loading…
Cancel
Save