mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- more texture wrappers and minor cleanup.
This commit is contained in:
parent
e5225e98e0
commit
63c1630cda
3 changed files with 27 additions and 11 deletions
|
@ -296,6 +296,8 @@ struct walltype
|
|||
|
||||
FTextureID walltexture() const;
|
||||
FTextureID overtexture() const;
|
||||
void setwalltexture(FTextureID tex);
|
||||
void setovertexture(FTextureID tex);
|
||||
};
|
||||
|
||||
// enable for running a compile-check to ensure that renderer-critical variables are not being written to directly.
|
||||
|
|
|
@ -695,31 +695,26 @@ PicAnm picanm;
|
|||
// wrappers that allow partial migration to a textureID-based setup.
|
||||
FTextureID walltype::walltexture() const
|
||||
{
|
||||
auto tex = tileGetTexture(wallpicnum);
|
||||
return tex ? tex->GetID() : FNullTextureID();
|
||||
return tileGetTextureID(wallpicnum);
|
||||
}
|
||||
FTextureID walltype::overtexture() const
|
||||
{
|
||||
auto tex = tileGetTexture(overpicnum);
|
||||
return tex ? tex->GetID() : FNullTextureID();
|
||||
return tileGetTextureID(overpicnum);
|
||||
}
|
||||
|
||||
const FTextureID sectortype::ceilingtexture() const
|
||||
{
|
||||
auto tex = tileGetTexture(ceilingpicnum);
|
||||
return tex ? tex->GetID() : FNullTextureID();
|
||||
return tileGetTextureID(ceilingpicnum);
|
||||
}
|
||||
|
||||
const FTextureID sectortype::floortexture() const
|
||||
{
|
||||
auto tex = tileGetTexture(floorpicnum);
|
||||
return tex ? tex->GetID() : FNullTextureID();
|
||||
return tileGetTextureID(floorpicnum);
|
||||
}
|
||||
|
||||
FTextureID spritetypebase::spritetexture() const
|
||||
{
|
||||
auto tex = tileGetTexture(picnum);
|
||||
return tex ? tex->GetID() : FNullTextureID();
|
||||
return tileGetTextureID(picnum);
|
||||
}
|
||||
|
||||
void sectortype::setfloortexture(FTextureID tex)
|
||||
|
@ -733,3 +728,16 @@ void sectortype::setceilingtexture(FTextureID tex)
|
|||
auto p = TileFiles.textotile.CheckKey(tex.GetIndex());
|
||||
if (p) ceilingpicnum = *p;
|
||||
}
|
||||
|
||||
void walltype::setwalltexture(FTextureID tex)
|
||||
{
|
||||
auto p = TileFiles.textotile.CheckKey(tex.GetIndex());
|
||||
if (p) wallpicnum = *p;
|
||||
}
|
||||
|
||||
void walltype::setovertexture(FTextureID tex)
|
||||
{
|
||||
auto p = TileFiles.textotile.CheckKey(tex.GetIndex());
|
||||
if (p) overpicnum = *p;
|
||||
else overpicnum = -1; // unlike the others this one can be invalid.
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ inline void tileUpdatePicnum(int* const tileptr, bool mayrotate = false, int ran
|
|||
|
||||
inline FGameTexture* tileGetTexture(int tile, bool animate = false)
|
||||
{
|
||||
assert((unsigned)tile < MAXTILES);
|
||||
assert((unsigned)tile < MAXTILES && tile != -1); // -1 is valid for overpicnum as 'no texture'.
|
||||
if (tile < 0 || tile >= MAXTILES) return nullptr;
|
||||
if (animate) tileUpdatePicnum(&tile);
|
||||
return TileFiles.tiledata[tile].texture;
|
||||
|
@ -483,6 +483,12 @@ inline FTextureID tileGetTextureID(int tile)
|
|||
return TileFiles.tiledata[tile].texture->GetID();
|
||||
}
|
||||
|
||||
inline int legacyTileNum(FTextureID tex)
|
||||
{
|
||||
auto p = TileFiles.textotile.CheckKey(tex.GetIndex());
|
||||
return p ? *p : -1;
|
||||
}
|
||||
|
||||
void tileUpdateAnimations();
|
||||
|
||||
struct TileImport
|
||||
|
|
Loading…
Reference in a new issue