Merge branch 'type-cleanup' into brushbsp
# Conflicts: # common/bspfile.cc # common/bspinfo.cc
This commit is contained in:
commit
26608c1b37
|
|
@ -497,6 +497,7 @@ public:
|
|||
// Q1-like games don't care about the local
|
||||
// filesystem.
|
||||
// they do care about the palette though.
|
||||
fs::clear();
|
||||
img::init_palette(this);
|
||||
}
|
||||
|
||||
|
|
@ -1107,6 +1108,8 @@ private:
|
|||
public:
|
||||
void init_filesystem(const fs::path &source, const settings::common_settings &settings) const override
|
||||
{
|
||||
fs::clear();
|
||||
|
||||
constexpr const char *MAPS_FOLDER = "maps";
|
||||
|
||||
// detect gamedir (mod directory path)
|
||||
|
|
|
|||
|
|
@ -439,10 +439,12 @@ void serialize_bsp(const bspdata_t &bspdata, const mbsp_t &bsp, const fs::path &
|
|||
tex.push_back({"width", src_tex.width});
|
||||
tex.push_back({"height", src_tex.height});
|
||||
|
||||
if (src_tex.data.size() > sizeof(dmiptex_t)) {
|
||||
json &mips = tex["mips"] = json::array();
|
||||
mips.emplace_back(serialize_image(img::load_mip(src_tex.name, src_tex.data, false, bspdata.loadversion->game)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bspdata.bspx.entries.empty()) {
|
||||
json &bspxentries = (j.emplace("bspxentries", json::array())).first.value();
|
||||
|
|
|
|||
|
|
@ -184,8 +184,9 @@ std::optional<texture> load_mip(const std::string &name, const fs::data &file, b
|
|||
if (!meta_only) {
|
||||
// convert the data into RGBA.
|
||||
if (header.offsets[0] <= 0) {
|
||||
// this should never happen under normal circumstances
|
||||
logging::funcprint("attempted to load external mip for {}\n", name);
|
||||
return tex;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
|
|
|
|||
12
qbsp/qbsp.cc
12
qbsp/qbsp.cc
|
|
@ -961,6 +961,18 @@ static void LoadTextureData()
|
|||
|
||||
if (!pos.archive->external) {
|
||||
miptex.data = std::move(file.value());
|
||||
} else {
|
||||
// construct fake data that solely contains the header.
|
||||
miptex.data.resize(sizeof(dmiptex_t));
|
||||
|
||||
dmiptex_t header {};
|
||||
std::copy(miptex.name.begin(), miptex.name.end(), header.name.begin());
|
||||
header.width = miptex.width;
|
||||
header.height = miptex.height;
|
||||
header.offsets = { -1, -1, -1, -1 };
|
||||
|
||||
omemstream stream(miptex.data.data(), miptex.data.size());
|
||||
stream <= header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue