diff options
author | Hugues Ross <hugues.ross@gmail.com> | 2020-08-04 14:12:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-04 20:12:47 +0200 |
commit | 93ecc589bc49a80187705f6e06df23a71263d3d7 (patch) | |
tree | ffb4cacc13843f2b7ef7cb5fcc192c0dfb3816d4 /src/texture_override.h | |
parent | d22fd6fc348ecf393f535c9b172410f4a82a2d52 (diff) | |
download | minetest-93ecc589bc49a80187705f6e06df23a71263d3d7.tar.gz minetest-93ecc589bc49a80187705f6e06df23a71263d3d7.tar.bz2 minetest-93ecc589bc49a80187705f6e06df23a71263d3d7.zip |
Implement override.txt support for special tiles (#10140)
Add override targets for all special_tiles entries in node definitions, allowing texture packs to replace these textures. This makes overrides work properly with a variety of drawtypes.
The targets are named special1 through special6, covering the the current length of the special_tiles array.
Diffstat (limited to 'src/texture_override.h')
-rw-r--r-- | src/texture_override.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/texture_override.h b/src/texture_override.h index db03bd014..bdc95e732 100644 --- a/src/texture_override.h +++ b/src/texture_override.h @@ -23,8 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> #include <vector> +typedef u16 override_t; + //! Bitmask enum specifying what a texture override should apply to -enum class OverrideTarget : u8 +enum class OverrideTarget : override_t { INVALID = 0, TOP = 1 << 0, @@ -35,23 +37,33 @@ enum class OverrideTarget : u8 BACK = 1 << 5, INVENTORY = 1 << 6, WIELD = 1 << 7, + SPECIAL_1 = 1 << 8, + SPECIAL_2 = 1 << 9, + SPECIAL_3 = 1 << 10, + SPECIAL_4 = 1 << 11, + SPECIAL_5 = 1 << 12, + SPECIAL_6 = 1 << 13, + // clang-format off SIDES = LEFT | RIGHT | FRONT | BACK, ALL_FACES = TOP | BOTTOM | SIDES, + ALL_SPECIAL = SPECIAL_1 | SPECIAL_2 | SPECIAL_3 | SPECIAL_4 | SPECIAL_5 | SPECIAL_6, + NODE_TARGETS = ALL_FACES | ALL_SPECIAL, ITEM_TARGETS = INVENTORY | WIELD, + // clang-format on }; struct TextureOverride { std::string id; std::string texture; - u8 target; + override_t target; // Helper function for checking if an OverrideTarget is found in // a TextureOverride without casting inline bool hasTarget(OverrideTarget overrideTarget) const { - return (target & static_cast<u8>(overrideTarget)) != 0; + return (target & static_cast<override_t>(overrideTarget)) != 0; } }; |