remove some stuff that makes decompiling maps more annoying to build

This commit is contained in:
Jonathan 2022-11-26 19:12:48 -05:00
parent 96e88cfab1
commit 62409458c6
1 changed files with 21 additions and 0 deletions

View File

@ -608,6 +608,8 @@ int main(int argc, char **argv)
Error("--replace-entities requires two arguments"); Error("--replace-entities requires two arguments");
} }
fmt::print("updating {} with {}\n", source, argv[i]);
// Load the .ent // Load the .ent
if (std::holds_alternative<mbsp_t>(bspdata.bsp)) { if (std::holds_alternative<mbsp_t>(bspdata.bsp)) {
fs::data ent = fs::load(argv[i]); fs::data ent = fs::load(argv[i]);
@ -655,6 +657,25 @@ int main(int argc, char **argv)
} }
} }
for (auto &ent : ents.entities) {
// remove origin key from brushed entities
if (!ent.map_brushes.empty() && ent.epairs.find("origin") != ent.epairs.end()) {
ent.epairs.remove("origin");
}
// remove style keys from areaportals and lights that
// have targetnames
if (ent.epairs.find("style") != ent.epairs.end()) {
if (ent.epairs.get("classname") == "light") {
if (ent.epairs.find("targetname") != ent.epairs.end()) {
ent.epairs.remove("style");
}
} else if (ent.epairs.get("classname") == "func_areaportal") {
ent.epairs.remove("style");
}
}
}
// write out .replaced.map // write out .replaced.map
fs::path output = fs::path(source).replace_extension(".replaced.map"); fs::path output = fs::path(source).replace_extension(".replaced.map");
std::ofstream strm(output, std::ios::binary); std::ofstream strm(output, std::ios::binary);