diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 17580955..41c97703 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -668,14 +668,13 @@ static contentflags_t Brush_GetContents(const mapbrush_t *mapbrush) for (int i = 0; i < mapbrush->numfaces; i++) { const mapface_t &mapface = mapbrush->face(i); const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); + contentflags_t contents = options.target_game->face_get_contents(mapface.texname.data(), texinfo.flags, mapface.contents); - if (texinfo.flags.is_skip) { + if (contents.is_empty(options.target_game)) { continue; } - - contentflags_t contents = options.target_game->face_get_contents(mapface.texname.data(), texinfo.flags, mapface.contents); - // use the first non-skip as the base contents value + // use the first non-empty as the base contents value if (!base_contents_set) { base_contents_set = true; base_contents = contents; diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index dd61d83c..f24e16f3 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -439,6 +439,12 @@ void FinishBSPFile(void) options.fVerbose = true; LogPrint(LOG_PROGRESS, "---- {} ----\n", __func__); + if (map.bsp.dvertexes.empty()) { + // First vertex must remain unused because edge references it + map.bsp.dvertexes.emplace_back(); + Q_assert(map.bsp.dvertexes.size() == 1); + } + WriteExtendedTexinfoFlags(); WriteBSPFile();