ref_soft: Fix R_NewMap, prevent crashes on changelevel/restart

This commit is contained in:
mittorn 2019-04-04 02:56:29 +07:00
parent e0cd5edddb
commit cefe42fd66
2 changed files with 39 additions and 32 deletions

View file

@ -1173,7 +1173,7 @@ int R_CreateDecalList( decallist_t *pList )
int total = 0; int total = 0;
int i, depth; int i, depth;
return 0; // crash on changelevel. API bug? // return 0; // crash on changelevel. API bug?
if( WORLDMODEL ) if( WORLDMODEL )
{ {

View file

@ -1822,7 +1822,10 @@ R_NewMap
*/ */
void R_NewMap (void) void R_NewMap (void)
{ {
int i;
r_viewcluster = -1; r_viewcluster = -1;
R_ClearDecals(); // clear all level decals
R_StudioResetPlayerModels();
D_FlushCaches( true ); D_FlushCaches( true );
@ -1860,6 +1863,10 @@ void R_NewMap (void)
{ {
auxedges = malloc (r_numallocatededges * sizeof(edge_t)); auxedges = malloc (r_numallocatededges * sizeof(edge_t));
} }
// clear out efrags in case the level hasn't been reloaded
for( i = 0; i < WORLDMODEL->numleafs; i++ )
WORLDMODEL->leafs[i+1].efrags = NULL;
} }
/* /*