bsputil: add --decompile-ignore-brushes option for visualizing leafs in q2 maps
This commit is contained in:
parent
490ea24fc1
commit
fe31e1c1ce
|
|
@ -617,8 +617,9 @@ int main(int argc, char **argv)
|
||||||
WriteBSPFile(source, &bspdata);
|
WriteBSPFile(source, &bspdata);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[i], "--decompile") || !strcmp(argv[i], "--decompile-geomonly")) {
|
} else if (!strcmp(argv[i], "--decompile") || !strcmp(argv[i], "--decompile-geomonly") || !strcmp(argv[i], "--decompile-ignore-brushes")) {
|
||||||
const bool geomOnly = !strcmp(argv[i], "--decompile-geomonly");
|
const bool geomOnly = !strcmp(argv[i], "--decompile-geomonly");
|
||||||
|
const bool ignoreBrushes = !strcmp(argv[i], "--decompile-ignore-brushes");
|
||||||
|
|
||||||
source.replace_extension("");
|
source.replace_extension("");
|
||||||
source.replace_filename(source.stem().string() + "-decompile");
|
source.replace_filename(source.stem().string() + "-decompile");
|
||||||
|
|
@ -632,6 +633,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
decomp_options options;
|
decomp_options options;
|
||||||
options.geometryOnly = geomOnly;
|
options.geometryOnly = geomOnly;
|
||||||
|
options.ignoreBrushes = ignoreBrushes;
|
||||||
|
|
||||||
DecompileBSP(&bsp, options, f);
|
DecompileBSP(&bsp, options, f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1053,7 +1053,7 @@ static void DecompileEntity(
|
||||||
|
|
||||||
// If we have brush info, we'll use that directly
|
// If we have brush info, we'll use that directly
|
||||||
// TODO: support BSPX brushes too
|
// TODO: support BSPX brushes too
|
||||||
if (bsp->loadversion->game->id == GAME_QUAKE_II) {
|
if (bsp->loadversion->game->id == GAME_QUAKE_II && !options.ignoreBrushes) {
|
||||||
std::unordered_map<const dbrush_t *, leaf_decompile_task> brushes;
|
std::unordered_map<const dbrush_t *, leaf_decompile_task> brushes;
|
||||||
|
|
||||||
auto handle_leaf = [&brushes, bsp, model](const mleaf_t *leaf) {
|
auto handle_leaf = [&brushes, bsp, model](const mleaf_t *leaf) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ struct decomp_options
|
||||||
* For debugging (there's not much that can go wrong).
|
* For debugging (there's not much that can go wrong).
|
||||||
*/
|
*/
|
||||||
bool geometryOnly = false;
|
bool geometryOnly = false;
|
||||||
|
/**
|
||||||
|
* If true, don't use brushes in Q2 .bsp's and instead decompile the leafs.
|
||||||
|
* Intended for visualizing leafs.
|
||||||
|
*/
|
||||||
|
bool ignoreBrushes = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DecompileBSP(const mbsp_t *bsp, const decomp_options &options, std::ofstream &file);
|
void DecompileBSP(const mbsp_t *bsp, const decomp_options &options, std::ofstream &file);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue