Browse Source

ref_soft: Fix R_NewMap, prevent crashes on changelevel/restart

pull/2/head
mittorn 5 years ago
parent
commit
cefe42fd66
  1. 2
      r_decals.c
  2. 7
      r_main.c

2
r_decals.c

@ -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 )
{ {

7
r_main.c

@ -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;
} }
/* /*

Loading…
Cancel
Save