From 62409458c64ce1f6074971d7503e2115a82b3d3c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 26 Nov 2022 19:12:48 -0500 Subject: [PATCH] remove some stuff that makes decompiling maps more annoying to build --- bsputil/bsputil.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bsputil/bsputil.cc b/bsputil/bsputil.cc index 1286982e..c2c12d85 100644 --- a/bsputil/bsputil.cc +++ b/bsputil/bsputil.cc @@ -608,6 +608,8 @@ int main(int argc, char **argv) Error("--replace-entities requires two arguments"); } + fmt::print("updating {} with {}\n", source, argv[i]); + // Load the .ent if (std::holds_alternative(bspdata.bsp)) { 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 fs::path output = fs::path(source).replace_extension(".replaced.map"); std::ofstream strm(output, std::ios::binary);