Commit b85bb958 by Hannu Hanhi

Use different variable for model texture search fix

parent 6a1566de
......@@ -78,8 +78,6 @@ struct GLPatch_s
UINT16 lumpnum; // was flushed, and we need to re-create it
void *rawpatch; // :^)
GLMipmap_t *mipmap;
boolean notfound; // if the texture file was not found, mark it here (used in model texture loading)
} ATTRPACK;
typedef struct GLPatch_s GLPatch_t;
......
......@@ -376,7 +376,7 @@ static void md2_loadTexture(md2_t *model)
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
model->notexturefile = true; // mark it so its not searched for again repeatedly
return;
}
......@@ -433,7 +433,7 @@ static void md2_loadBlendTexture(md2_t *model)
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->grInfo.format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
......@@ -469,6 +469,8 @@ void HWR_InitModels(void)
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].notexturefile = false;
md2_playermodels[s].noblendfile = false;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
......@@ -478,6 +480,8 @@ void HWR_InitModels(void)
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].notexturefile = false;
md2_models[i].noblendfile = false;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
......@@ -1302,14 +1306,14 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
finalscale = md2->scale;
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
&& !md2->noblendfile)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
......
......@@ -28,7 +28,9 @@ typedef struct
float offset;
model_t *model;
void *grpatch;
boolean notexturefile; // true if texture file was not found
void *blendgrpatch;
boolean noblendfile; // true if blend texture file was not found
boolean notfound;
INT32 skin;
boolean error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment