- made adjustments to the texture loading code to account for the recent changes to handle long texture names.

This commit is contained in:
Christoph Oelckers 2014-05-15 19:27:22 +02:00
parent 4e64ad847b
commit 03d4f23a6e
5 changed files with 14 additions and 49 deletions

View file

@ -141,14 +141,7 @@ FTexture * LoadSkin(const char * path, const char * fn)
int texlump = FindGFXFile(buffer);
if (texlump>=0)
{
FTextureID texno = TexMan.FindTextureByLumpNum(texlump);
if (!texno.isValid())
{
FTexture *tex = FTexture::CreateTexture("", texlump, FTexture::TEX_Override);
TexMan.AddTexture(tex);
return tex;
}
return TexMan[texno];
return TexMan.FindTexture(Wads.GetLumpFullName(texlump), FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
}
else
{

View file

@ -855,7 +855,7 @@ void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader)
FTexture *layer;
if (mTextureLayers[i].animated)
{
FTextureID id = mTextureLayers[i].texture->GetID();
FTextureID id = mTextureLayers[i].texture->id;
layer = TexMan(id);
ValidateSysTexture(layer, false);
}

View file

@ -205,15 +205,13 @@ void gl_ParseVavoomSkybox()
sc.MustGetString();
maplump = Wads.CheckNumForFullName(sc.String, true);
if (maplump==-1)
Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name);
FTextureID tex = TexMan.FindTextureByLumpNum(maplump);
if (!tex.isValid())
FTexture *tex = TexMan.FindTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny);
if (tex != NULL)
{
tex = TexMan.CreateTexture(maplump, FTexture::TEX_MiscPatch);
Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name);
}
sb->faces[facecount] = TexMan[tex];
sb->faces[facecount] = tex;
sc.MustGetStringName("}");
}
facecount++;

View file

@ -696,8 +696,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
bool disable_fullbright=false;
bool thiswad = false;
bool iwad = false;
int maplump = -1;
FString maplumpname;
FTexture *bmtex = NULL;
sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
@ -734,17 +733,15 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
{
sc.MustGetString();
if (maplump >= 0)
if (bmtex != NULL)
{
Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name : "(null)");
}
maplump = Wads.CheckNumForFullName(sc.String, true);
bmtex = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
if (maplump==-1)
if (bmtex == NULL)
Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name : "(null)");
maplumpname = sc.String;
}
}
if (!tex)
@ -764,7 +761,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
if (!useme) return;
}
if (maplump != -1)
if (bmtex != NULL)
{
if (tex->bWarped != 0)
{
@ -772,31 +769,8 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
return;
}
// Brightmap textures are stored in the texture manager so that multiple
// instances of the same textures can be avoided.
FTexture *brightmap;
FTextureID brightmapId = TexMan.FindTextureByLumpNum(maplump);
if (!brightmapId.isValid())
{
// a texture for this lump has not been created yet.
brightmap = FTexture::CreateTexture(maplump, tex->UseType);
if (!brightmap)
{
Printf("Unable to create texture from '%s' in brightmap definition for '%s'\n",
maplumpname.GetChars(), tex->Name);
return;
}
brightmap->gl_info.bBrightmap = true;
brightmap->Name[0] = 0; // brightmaps don't have names
TexMan.AddTexture(brightmap);
}
else
{
brightmap = TexMan[brightmapId];
}
tex->gl_info.Brightmap = brightmap;
bmtex->gl_info.bBrightmap = true;
tex->gl_info.Brightmap = bmtex;
}
tex->gl_info.bBrightmapDisablesFullbright = disable_fullbright;
}

View file

@ -183,7 +183,7 @@ void CheckBench()
FString compose;
compose.Format("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n",
level.mapname, level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz),
level.MapName.GetChars(), level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz),
ANGLE_TO_FLOAT(viewangle), ANGLE_TO_FLOAT(viewpitch));
AppendRenderStats(compose);