From 7656d5c2f127c1d843bd28c400f4ca7480a61ec5 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 7 Jul 2017 20:26:27 -0600 Subject: [PATCH] qbsp: external map: merge all brush entities with worldspawn --- man/qbsp.1 | 6 ++++-- qbsp/map.cc | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/man/qbsp.1 b/man/qbsp.1 index 749e1f9d..db7cf4fc 100644 --- a/man/qbsp.1 +++ b/man/qbsp.1 @@ -133,8 +133,10 @@ to the "origin" key of the "misc_external_map" entity. Finally, the classname of key. (The "origin" key is also cleared to "0 0 0" before saving the .bsp). .PP -The external .map file should consist of worldspawn brushes only. All worldspawn keys, -and any entities aside from worldspawn in the external map are ignored. +The external .map file should consist of worldspawn brushes only, although +you can use func_group for editing convenience. Brush entities are merged +with the worldspawn brushes during import. All worldspawn keys, and any point +entities are ignored. Currently, this means that the "wad" key is not handled, so you need to add any texture wads required by the external .map file to your main map. diff --git a/qbsp/map.cc b/qbsp/map.cc index a46fae0d..b575f716 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -1704,10 +1704,13 @@ mapentity_t LoadExternalMap(const char *filename) Error("LoadExternalMap: '%s': Expected first entity to be worldspawn, got: '%s'\n", filename, classname); } - // parse the next entity, warn if there was one + // parse any subsequent entities, move any brushes to worldspawn mapentity_t dummy {}; - if (ParseEntity(&parser, &dummy)) { - Message(msgStat, "LoadExternalMap: '%s': Ignoring entities after the worldspawn\n", filename); + while (ParseEntity(&parser, &dummy)) { + // this is kind of fragile, but move the brushes to the worldspawn. + if (dummy.nummapbrushes) { + dest.nummapbrushes += dummy.nummapbrushes; + } } if (!dest.nummapbrushes) {