mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
ref_soft: Fix cache flush on reconnect, fix division by zero in decals
This commit is contained in:
parent
79405c7cc9
commit
320a3b0834
@ -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);
|
||||
//
|
||||
// r_surf.c
|
||||
//
|
||||
void D_FlushCaches( qboolean newmap );
|
||||
void D_FlushCaches( void );
|
||||
|
||||
//
|
||||
// r_draw.c
|
||||
|
6
r_main.c
6
r_main.c
@ -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 )
|
||||
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)
|
||||
R_ClearDecals(); // clear all level decals
|
||||
R_StudioResetPlayerModels();
|
||||
|
||||
D_FlushCaches( true );
|
||||
D_FlushCaches();
|
||||
|
||||
r_cnumsurfs = sw_maxsurfs->value;
|
||||
|
||||
|
2
r_misc.c
2
r_misc.c
@ -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
12
r_surf.c
@ -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)
|
||||
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 )
|
||||
*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()
|
||||
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…
x
Reference in New Issue
Block a user