Fix the missing world on map reload.

If the map got reloaded but the current leaf didn't change the world (and
most entities) didn't get drawn. Forcing a vis update by first setting
r_viewleaf to null and marking surfaces does the trick :)
This commit is contained in:
Bill Currie 2012-01-29 16:09:35 +09:00
parent 462a9047c6
commit 8f869c001b
5 changed files with 15 additions and 0 deletions

View file

@ -192,7 +192,10 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
for (i = 0; i < r_worldentity.model->numleafs; i++) for (i = 0; i < r_worldentity.model->numleafs; i++)
r_worldentity.model->leafs[i].efrags = NULL; r_worldentity.model->leafs[i].efrags = NULL;
// Force a vis update
r_viewleaf = NULL; r_viewleaf = NULL;
R_MarkLeaves ();
R_ClearParticles (); R_ClearParticles ();
GL_BuildLightmaps (models, num_models); GL_BuildLightmaps (models, num_models);

View file

@ -274,6 +274,10 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
memset (&r_worldentity, 0, sizeof (r_worldentity)); memset (&r_worldentity, 0, sizeof (r_worldentity));
r_worldentity.model = worldmodel; r_worldentity.model = worldmodel;
// Force a vis update
r_viewleaf = NULL;
R_MarkLeaves ();
R_FreeAllEntities (); R_FreeAllEntities ();
R_ClearParticles (); R_ClearParticles ();
R_RegisterTextures (models, num_models); R_RegisterTextures (models, num_models);

View file

@ -63,6 +63,8 @@ R_MarkLeaves (void)
r_visframecount++; r_visframecount++;
r_oldviewleaf = r_viewleaf; r_oldviewleaf = r_viewleaf;
if (!r_viewleaf)
return;
if (r_novis->int_val) { if (r_novis->int_val) {
r_oldviewleaf = 0; // so vis will be recalcualted when novis gets r_oldviewleaf = 0; // so vis will be recalcualted when novis gets

View file

@ -199,7 +199,10 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
if (worldmodel->skytexture) if (worldmodel->skytexture)
R_InitSky (worldmodel->skytexture); R_InitSky (worldmodel->skytexture);
// Force a vis update
r_viewleaf = NULL; r_viewleaf = NULL;
R_MarkLeaves ();
R_ClearParticles (); R_ClearParticles ();
r_cnumsurfs = r_maxsurfs->int_val; r_cnumsurfs = r_maxsurfs->int_val;

View file

@ -227,7 +227,10 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
if (worldmodel->skytexture) if (worldmodel->skytexture)
R_InitSky (worldmodel->skytexture); R_InitSky (worldmodel->skytexture);
// Force a vis update
r_viewleaf = NULL; r_viewleaf = NULL;
R_MarkLeaves ();
R_ClearParticles (); R_ClearParticles ();
r_cnumsurfs = r_maxsurfs->int_val; r_cnumsurfs = r_maxsurfs->int_val;