qbsp: fix -notex option
This commit is contained in:
parent
f3b559ad92
commit
8888506821
|
|
@ -121,6 +121,7 @@ void miptex_t::stream_read(std::istream &stream, size_t len)
|
|||
name = dtex.name.data();
|
||||
width = dtex.width;
|
||||
height = dtex.height;
|
||||
offsets = dtex.offsets;
|
||||
}
|
||||
|
||||
void miptex_t::stream_write(std::ostream &stream) const
|
||||
|
|
|
|||
|
|
@ -329,6 +329,14 @@ Options
|
|||
avoids inclusion of third-party copyrighted images inside your maps,
|
||||
but is not backwards compatible but will work in FTEQW and QSS.
|
||||
|
||||
Note that the textures still need to be available to qbsp.
|
||||
|
||||
Technical details: ``LUMP_TEXTURES`` is still written, but each texture
|
||||
within is the ``dmiptex_t`` header only (with no texture data following),
|
||||
with ``offsets`` all set to 0.
|
||||
|
||||
This only has effect in Q1 family games.
|
||||
|
||||
.. option:: -notjunc
|
||||
|
||||
Alias for :option:`-tjunc none`
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ struct miptex_t
|
|||
* set at read time if the offset is -1
|
||||
*/
|
||||
bool null_texture = false;
|
||||
/**
|
||||
* exposed for testing -notex
|
||||
*/
|
||||
std::array<int32_t, MIPLEVELS> offsets;
|
||||
|
||||
size_t stream_size() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1571,7 +1571,7 @@ static void LoadTextureData()
|
|||
|
||||
header.width = miptex.width;
|
||||
header.height = miptex.height;
|
||||
header.offsets = {-1, -1, -1, -1};
|
||||
header.offsets = {0, 0, 0, 0};
|
||||
|
||||
omemstream stream(miptex.data.data(), miptex.data.size());
|
||||
stream <= header;
|
||||
|
|
|
|||
|
|
@ -1904,6 +1904,40 @@ TEST_CASE("q1_missing_texture")
|
|||
|
||||
CHECK("" == bsp.dtex.textures[1].name);
|
||||
CHECK(bsp.dtex.textures[1].null_texture);
|
||||
|
||||
CHECK(6 == bsp.dfaces.size());
|
||||
}
|
||||
|
||||
TEST_CASE("q1 notex")
|
||||
{
|
||||
const auto [bsp, bspx, prt] = LoadTestmap("q1_cube.map", {"-notex"});
|
||||
|
||||
REQUIRE(2 == bsp.dtex.textures.size());
|
||||
|
||||
{
|
||||
// FIXME: we shouldn't really be writing skip
|
||||
// (our test data includes an actual "skip" texture,
|
||||
// so that gets included in the bsp.)
|
||||
auto &t0 = bsp.dtex.textures[0];
|
||||
CHECK("skip" == t0.name);
|
||||
CHECK(!t0.null_texture);
|
||||
CHECK(64 == t0.width);
|
||||
CHECK(64 == t0.height);
|
||||
CHECK(t0.data.size() == sizeof(dmiptex_t));
|
||||
for (int i = 0; i < 4; ++i)
|
||||
CHECK(t0.offsets[i] == 0);
|
||||
}
|
||||
|
||||
{
|
||||
auto &t1 = bsp.dtex.textures[1];
|
||||
CHECK("orangestuff8" == t1.name);
|
||||
CHECK(!t1.null_texture);
|
||||
CHECK(64 == t1.width);
|
||||
CHECK(64 == t1.height);
|
||||
CHECK(t1.data.size() == sizeof(dmiptex_t));
|
||||
for (int i = 0; i < 4; ++i)
|
||||
CHECK(t1.offsets[i] == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("hl_basic")
|
||||
|
|
|
|||
Loading…
Reference in New Issue