Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
This commit is contained in:
commit
af2f88b93c
|
|
@ -630,9 +630,13 @@ int main(int argc, char **argv)
|
|||
hullnum = std::stoi(argv[i + 1]);
|
||||
}
|
||||
|
||||
source.replace_extension("");
|
||||
source.replace_filename(source.stem().string() + "-decompile");
|
||||
source.replace_extension(".map");
|
||||
// generate output filename
|
||||
if (hull) {
|
||||
source.replace_extension(fmt::format(".decompile.hull{}.map", hullnum));
|
||||
} else {
|
||||
source.replace_extension(".decompile.map");
|
||||
}
|
||||
|
||||
fmt::print("-> writing {}...\n", source);
|
||||
|
||||
std::ofstream f(source);
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ struct surfflags_t
|
|||
int32_t native;
|
||||
|
||||
// an invisible surface (Q1 "skip" texture, Q2 SURF_NODRAW)
|
||||
bool is_skip;
|
||||
bool is_nodraw;
|
||||
|
||||
// completely ignore, allowing non-closed brushes (Q2 SURF_SKIP)
|
||||
bool is_hintskip;
|
||||
|
|
@ -220,7 +220,7 @@ struct surfflags_t
|
|||
private:
|
||||
constexpr auto as_tuple() const
|
||||
{
|
||||
return std::tie(native, is_skip, is_hintskip, is_hint, no_dirt, no_shadow, no_bounce, no_minlight, no_expand,
|
||||
return std::tie(native, is_nodraw, is_hintskip, is_hint, no_dirt, no_shadow, no_bounce, no_minlight, no_expand,
|
||||
light_ignore, phong_angle, phong_angle_concave, minlight, minlight_color, light_alpha, maxlight, lightcolorscale);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -763,8 +763,8 @@ static void LoadExtendedTexinfoFlags(const fs::path &sourcefilename, const mbsp_
|
|||
auto &val = it.value();
|
||||
auto &flags = extended_texinfo_flags[index];
|
||||
|
||||
if (val.contains("is_skip")) {
|
||||
flags.is_skip = val.at("is_skip").get<bool>();
|
||||
if (val.contains("is_nodraw")) {
|
||||
flags.is_nodraw = val.at("is_nodraw").get<bool>();
|
||||
}
|
||||
if (val.contains("is_hint")) {
|
||||
flags.is_hint = val.at("is_hint").get<bool>();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ bool side_t::is_visible() const
|
|||
{
|
||||
// workaround for qbsp_q2_mist_clip.map - we want to treat nodraw faces as "!visible"
|
||||
// so they're used as splitters after mist
|
||||
if (get_texinfo().flags.is_skip) {
|
||||
if (get_texinfo().flags.is_nodraw) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ static void ExportObj_Marksurfaces_r(const node_t *node, std::unordered_set<cons
|
|||
}
|
||||
|
||||
for (auto &face : node->markfaces) {
|
||||
if (!face->get_texinfo().flags.is_skip) {
|
||||
if (!face->get_texinfo().flags.is_nodraw) {
|
||||
dest->insert(face);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct makefaces_stats_t : logging::stat_tracker_t
|
|||
|
||||
static bool ShouldOmitFace(face_t *f)
|
||||
{
|
||||
if (!qbsp_options.includeskip.value() && f->get_texinfo().flags.is_skip)
|
||||
if (!qbsp_options.includeskip.value() && f->get_texinfo().flags.is_nodraw)
|
||||
return true;
|
||||
if (map.mtexinfos.at(f->texinfo).flags.is_hint)
|
||||
return true;
|
||||
|
|
@ -329,7 +329,7 @@ static std::list<std::unique_ptr<face_t>> SubdivideFace(std::unique_ptr<face_t>
|
|||
/* special (non-surface cached) faces don't need subdivision */
|
||||
const maptexinfo_t &tex = f->get_texinfo();
|
||||
|
||||
if (tex.flags.is_skip || tex.flags.is_hint || !qbsp_options.target_game->surf_is_subdivided(tex.flags)) {
|
||||
if (tex.flags.is_nodraw || tex.flags.is_hint || !qbsp_options.target_game->surf_is_subdivided(tex.flags)) {
|
||||
std::list<std::unique_ptr<face_t>> result;
|
||||
result.push_back(std::move(f));
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ static surfflags_t SurfFlagsForEntity(const maptexinfo_t &texinfo, const mapenti
|
|||
// splitturb, etc) from there.
|
||||
if (qbsp_options.target_game->id != GAME_QUAKE_II) {
|
||||
if (IsSkipName(texname))
|
||||
flags.is_skip = true;
|
||||
flags.is_nodraw = true;
|
||||
if (IsHintName(texname))
|
||||
flags.is_hint = true;
|
||||
if (IsSpecialName(texname))
|
||||
|
|
@ -537,7 +537,7 @@ static surfflags_t SurfFlagsForEntity(const maptexinfo_t &texinfo, const mapenti
|
|||
flags.native = texinfo.flags.native;
|
||||
|
||||
if ((flags.native & Q2_SURF_NODRAW) || IsSkipName(texname))
|
||||
flags.is_skip = true;
|
||||
flags.is_nodraw = true;
|
||||
if ((flags.native & Q2_SURF_HINT) || IsHintName(texname))
|
||||
flags.is_hint = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ static void ProcessEntity(mapentity_t &entity, hull_index_t hullnum)
|
|||
if (FillOutside(tree, hullnum, brushes)) {
|
||||
// make a really good tree
|
||||
tree.clear();
|
||||
BrushBSP(tree, entity, brushes, tree_split_t::AUTO);
|
||||
BrushBSP(tree, entity, brushes, tree_split_t::PRECISE);
|
||||
|
||||
// fill again so PruneNodes works
|
||||
MakeTreePortals(tree);
|
||||
|
|
@ -554,6 +554,7 @@ static void ProcessEntity(mapentity_t &entity, hull_index_t hullnum)
|
|||
FreeTreePortals(tree);
|
||||
PruneNodes(tree.headnode);
|
||||
}
|
||||
CountLeafs(tree.headnode);
|
||||
}
|
||||
ExportClipNodes(entity, tree.headnode, hullnum.value());
|
||||
return;
|
||||
|
|
@ -1064,7 +1065,7 @@ static int MakeSkipTexinfo()
|
|||
maptexinfo_t mt{};
|
||||
|
||||
mt.miptex = FindMiptex("skip", true);
|
||||
mt.flags.is_skip = true;
|
||||
mt.flags.is_nodraw = true;
|
||||
|
||||
return FindTexinfo(mt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ size_t ExportMapTexinfo(size_t texinfonum)
|
|||
|
||||
if (src.outputnum.has_value())
|
||||
return src.outputnum.value();
|
||||
else if (!qbsp_options.includeskip.value() && src.flags.is_skip)
|
||||
else if (!qbsp_options.includeskip.value() && src.flags.is_nodraw)
|
||||
return -1;
|
||||
|
||||
// this will be the index of the exported texinfo in the BSP lump
|
||||
|
|
@ -169,7 +169,7 @@ static void ExportLeaf(node_t *node)
|
|||
dleaf.firstmarksurface = static_cast<int>(map.bsp.dleaffaces.size());
|
||||
|
||||
for (auto &face : node->markfaces) {
|
||||
if (!qbsp_options.includeskip.value() && face->get_texinfo().flags.is_skip) {
|
||||
if (!qbsp_options.includeskip.value() && face->get_texinfo().flags.is_nodraw) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -333,8 +333,8 @@ static void WriteExtendedTexinfoFlags(void)
|
|||
|
||||
json t = json::object();
|
||||
|
||||
if (tx.flags.is_skip) {
|
||||
t["is_skip"] = tx.flags.is_skip;
|
||||
if (tx.flags.is_nodraw) {
|
||||
t["is_nodraw"] = tx.flags.is_nodraw;
|
||||
}
|
||||
if (tx.flags.is_hint) {
|
||||
t["is_hint"] = tx.flags.is_hint;
|
||||
|
|
|
|||
Loading…
Reference in New Issue