misc_external_map: fix -onlyents

This commit is contained in:
Eric Wasylishen 2017-06-15 17:38:49 -06:00
parent ce8ad6c384
commit 73ffb37417
2 changed files with 23 additions and 4 deletions

View File

@ -1616,6 +1616,8 @@ static void TranslateMapFace(mapface_t *face, const vec3_t offset)
void
ProcessExternalMapEntity(mapentity_t *entity)
{
Q_assert(!options.fOnlyents);
const char *classname = ValueForKey(entity, "classname");
if (Q_strcasecmp(classname, "misc_external_map"))
return;
@ -1626,6 +1628,8 @@ ProcessExternalMapEntity(mapentity_t *entity)
Q_assert(file && file[0]);
Q_assert(new_classname && new_classname[0]);
Q_assert(0 == entity->nummapbrushes); // misc_external_map must be a point entity
const mapentity_t external_worldspawn = LoadExternalMap(file);
// copy the brushes into the target

View File

@ -251,11 +251,26 @@ UpdateEntLump(void)
modnum = 1;
for (i = 1; i < map.numentities(); i++) {
entity = &map.entities.at(i);
if (!entity->nummapbrushes)
continue;
/* Load external .map and change the classname, if needed */
ProcessExternalMapEntity(entity);
/* Special handling for misc_external_map.
Duplicates some logic from ProcessExternalMapEntity. */
qboolean is_misc_external_map = false;
if (!Q_strcasecmp(ValueForKey(entity, "classname"), "misc_external_map")) {
const char *new_classname = ValueForKey(entity, "_external_map_classname");
SetKeyValue(entity, "classname", new_classname);
SetKeyValue(entity, "origin", "0 0 0");
/* Note: the classname could have switched to
* a IsWorldBrushEntity entity (func_group, func_detail),
* or a bmodel entity (func_wall
*/
is_misc_external_map = true;
}
qboolean isBrushEnt = (entity->nummapbrushes > 0) || is_misc_external_map;
if (!isBrushEnt)
continue;
if (IsWorldBrushEntity(entity))
continue;