raze/source/core/textures/buildtiles.h

108 lines
2.5 KiB
C
Raw Normal View History

2020-05-24 05:58:56 +00:00
#pragma once
#include <limits.h>
2020-05-24 05:58:56 +00:00
#include "textures.h"
#include "image.h"
#include "i_time.h"
#include "intvec.h"
#include "name.h"
#include "tiletexture.h"
#include "maptypes.h"
#include "texinfo.h"
#include "texturemanager.h"
2020-05-24 11:53:27 +00:00
// all that's left here is the wrappers that need to go away.
2020-05-24 11:53:27 +00:00
2020-05-24 05:58:56 +00:00
// wrappers that allow partial migration to a textureID-based setup.
inline const FTextureID walltype::walltexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(wallpicnum);
}
inline const FTextureID walltype::overtexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(overpicnum);
}
2020-05-24 05:58:56 +00:00
inline const FTextureID sectortype::ceilingtexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(ceilingpicnum);
}
2020-05-24 05:58:56 +00:00
inline const FTextureID sectortype::floortexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(floorpicnum);
}
2020-05-24 05:58:56 +00:00
inline const FTextureID spritetypebase::spritetexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(picnum);
}
2020-05-24 05:58:56 +00:00
inline void sectortype::setfloortexture(FTextureID tex)
2021-04-06 13:55:33 +00:00
{
floorpicnum = legacyTileNum(tex);
}
2021-04-06 13:55:33 +00:00
inline void sectortype::setceilingtexture(FTextureID tex)
{
ceilingpicnum = legacyTileNum(tex);
}
inline void walltype::setwalltexture(FTextureID tex)
{
wallpicnum = legacyTileNum(tex);
}
inline void walltype::setovertexture(FTextureID tex)
2020-05-24 05:58:56 +00:00
{
if (tex.isValid()) overpicnum = legacyTileNum(tex);
else overpicnum = -1; // unlike the others this one can be invalid.
}
2020-05-24 05:58:56 +00:00
//[[deprecated]]
inline int tileForName(const char* name)
{
auto texid = TexMan.CheckForTexture(name, ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnAll);
if (!texid.isValid()) return -1;
return legacyTileNum(texid);
}
2020-05-24 05:58:56 +00:00
// Some hacks to allow accessing the no longer existing arrays as if they still were arrays to avoid changing hundreds of lines of code.
struct PicAnm
{
//[[deprecated]]
const picanm_t& operator[](int index) const
2020-05-24 05:58:56 +00:00
{
assert((unsigned)index < MAXTILES);
return GetExtInfo(tileGetTextureID(index)).picanm;
2020-05-24 05:58:56 +00:00
}
};
inline PicAnm picanm;
2020-05-24 05:58:56 +00:00
//[[deprecated]]
2020-05-24 05:58:56 +00:00
inline int tileWidth(int num)
{
auto texid = tileGetTextureID(num);
if (!texid.isValid()) return 1;
else return (int)TexMan.GetGameTexture(texid)->GetDisplayWidth();
2020-05-24 05:58:56 +00:00
}
//[[deprecated]]
2020-05-24 05:58:56 +00:00
inline int tileHeight(int num)
{
auto texid = tileGetTextureID(num);
if (!texid.isValid()) return 1;
else return (int)TexMan.GetGameTexture(texid)->GetDisplayHeight();
}
//[[deprecated]]
inline FGameTexture* tileGetTexture(int tile, bool animate = false)
2020-05-24 10:31:38 +00:00
{
auto texid = tileGetTextureID(tile);
if (animate) tileUpdatePicnum(texid);
return TexMan.GetGameTexture(texid);
}