fix hintskip; when loading a hint brush, mark all other sides as hintskip

This commit is contained in:
Jonathan 2023-04-03 05:26:41 -04:00
parent d067630bc1
commit a0e98242a4
3 changed files with 28 additions and 3 deletions

View File

@ -161,12 +161,12 @@ struct surfflags_t
// an invisible surface (Q1 "skip" texture, Q2 SURF_NODRAW)
bool is_nodraw;
// completely ignore, allowing non-closed brushes (Q2 SURF_SKIP)
bool is_hintskip;
// hint surface
bool is_hint;
// is a skip surface from a hint brush
bool is_hintskip;
// don't receive dirtmapping
bool no_dirt;

View File

@ -1092,6 +1092,9 @@ static void LoadExtendedTexinfoFlags(const fs::path &sourcefilename, const mbsp_
if (val.contains("is_hint")) {
flags.is_hint = val.at("is_hint").get<bool>();
}
if (val.contains("is_hintskip")) {
flags.is_hintskip = val.at("is_hintskip").get<bool>();
}
if (val.contains("no_dirt")) {
flags.no_dirt = val.at("no_dirt").get<bool>();
}

View File

@ -2409,6 +2409,8 @@ static mapbrush_t ParseBrush(parser_t &parser, mapentity_t &entity, texture_def_
}
// ericw -- end brush primitives
bool is_hint = false;
while (parser.parse_token()) {
// set linenum after first parsed token
@ -2444,10 +2446,30 @@ static mapbrush_t ParseBrush(parser_t &parser, mapentity_t &entity, texture_def_
continue;
}
if (face->get_texinfo().flags.is_hint) {
is_hint = true;
}
/* Save the face, update progress */
brush.faces.emplace_back(std::move(face.value()));
}
// mark hintskip faces
if (is_hint) {
int32_t num_hintskip = 0;
for (auto &face : brush.faces) {
if (qbsp_options.target_game->texinfo_is_hintskip(face.get_texinfo().flags, map.miptexTextureName(face.get_texinfo().miptex))) {
auto copy = face.get_texinfo();
copy.flags.is_hintskip = true;
face.texinfo = FindTexinfo(copy);
num_hintskip++;
}
}
//logging::print("{}: {} hintskip faces\n", parser.location, num_hintskip);
}
// ericw -- brush primitives - there should be another closing }
if (brush.format == brushformat_t::BRUSH_PRIMITIVES) {
if (!parser.parse_token())