raze/source/core/textures/buildtiles.h

76 lines
1.7 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 spritetypebase::spritetexture() const
2020-05-24 05:58:56 +00:00
{
return tileGetTextureID(picnum);
}
2020-05-24 05:58:56 +00:00
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);
}
//[[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);
}