don't segfault when a surface uses the `null' texture (r_notexture_mip)

This commit is contained in:
Bill Currie 2002-08-09 06:07:25 +00:00
parent a431a2783c
commit 4123d74e5e
2 changed files with 11 additions and 2 deletions

View file

@ -170,6 +170,7 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
{
cvar_t *r_skyname;
int i;
texture_t *tex;
for (i = 0; i < 256; i++)
d_lightstylevalue[i] = 264; // normal light value
@ -190,7 +191,7 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
skytexturenum = -1;
mirrortexturenum = -1;
for (i = 0; i < r_worldentity.model->numtextures; i++) {
texture_t *tex = r_worldentity.model->textures[i];
tex = r_worldentity.model->textures[i];
if (!tex)
continue;
if (!strncmp (tex->name, "sky", 3))
@ -200,6 +201,10 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
tex->texturechain = NULL;
tex->texturechain_tail = &tex->texturechain;
}
tex = r_notexture_mip;
tex->texturechain = NULL;
tex->texturechain_tail = &tex->texturechain;
r_skyname = Cvar_FindVar ("r_skyname");
if (r_skyname != NULL)
R_LoadSkys (r_skyname->string);

View file

@ -244,11 +244,12 @@ DrawTextureChains (void)
{
int i;
msurface_t *s;
texture_t *tex;
qfglDisable (GL_BLEND);
for (i = 0; i < r_worldentity.model->numtextures; i++) {
texture_t *tex = r_worldentity.model->textures[i];
tex = r_worldentity.model->textures[i];
if (!tex)
continue;
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
@ -258,6 +259,9 @@ DrawTextureChains (void)
tex->texturechain = NULL;
tex->texturechain_tail = &tex->texturechain;
}
tex = r_notexture_mip;
tex->texturechain = NULL;
tex->texturechain_tail = &tex->texturechain;
qfglEnable (GL_BLEND);
}