2019-10-05 17:28:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-05-24 14:11:10 +00:00
|
|
|
enum class ETextureType : uint8_t
|
|
|
|
{
|
|
|
|
Any,
|
|
|
|
Wall,
|
|
|
|
Flat,
|
|
|
|
Sprite,
|
|
|
|
WallPatch,
|
|
|
|
Build, // no longer used but needs to remain for ZScript
|
|
|
|
SkinSprite,
|
|
|
|
Decal,
|
|
|
|
MiscPatch,
|
|
|
|
FontChar,
|
|
|
|
Override, // For patches between TX_START/TX_END
|
|
|
|
Autopage, // Automap background - used to enable the use of FAutomapTexture
|
|
|
|
SkinGraphic,
|
|
|
|
Null,
|
|
|
|
FirstDefined,
|
2020-05-25 21:59:07 +00:00
|
|
|
Special,
|
2020-05-24 14:11:10 +00:00
|
|
|
SWCanvas,
|
|
|
|
};
|
|
|
|
|
2019-10-05 17:28:05 +00:00
|
|
|
class FTextureID
|
|
|
|
{
|
|
|
|
friend class FTextureManager;
|
2020-05-24 14:11:10 +00:00
|
|
|
friend void R_InitSpriteDefs();
|
2019-10-05 17:28:05 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
FTextureID() = default;
|
|
|
|
bool isNull() const { return texnum == 0; }
|
|
|
|
bool isValid() const { return texnum > 0; }
|
|
|
|
bool Exists() const { return texnum >= 0; }
|
|
|
|
void SetInvalid() { texnum = -1; }
|
|
|
|
void SetNull() { texnum = 0; }
|
|
|
|
bool operator ==(const FTextureID &other) const { return texnum == other.texnum; }
|
|
|
|
bool operator !=(const FTextureID &other) const { return texnum != other.texnum; }
|
|
|
|
FTextureID operator +(int offset) throw();
|
|
|
|
int GetIndex() const { return texnum; } // Use this only if you absolutely need the index!
|
2020-05-24 14:11:10 +00:00
|
|
|
void SetIndex(int index) { texnum = index; } // Use this only if you absolutely need the index!
|
2019-10-05 17:28:05 +00:00
|
|
|
|
|
|
|
// The switch list needs these to sort the switches by texture index
|
|
|
|
int operator -(FTextureID other) const { return texnum - other.texnum; }
|
|
|
|
bool operator < (FTextureID other) const { return texnum < other.texnum; }
|
|
|
|
bool operator > (FTextureID other) const { return texnum > other.texnum; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
FTextureID(int num) { texnum = num; }
|
|
|
|
private:
|
|
|
|
int texnum;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This is for the script interface which needs to do casts from int to texture.
|
|
|
|
class FSetTextureID : public FTextureID
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FSetTextureID(int v) : FTextureID(v) {}
|
|
|
|
};
|
2020-05-24 14:11:10 +00:00
|
|
|
|