Compress texinfo a bit

This commit is contained in:
Jonathan 2021-10-22 03:50:15 -04:00
parent a21be0362c
commit 443be60a74
3 changed files with 84 additions and 30 deletions

View File

@ -523,19 +523,45 @@ static void LoadExtendedTexinfoFlags(const std::filesystem::path &sourcefilename
auto &val = it.value();
auto &flags = extended_texinfo_flags[index];
flags.is_skip = val.at("is_skip").get<bool>();
flags.is_hint = val.at("is_hint").get<bool>();
flags.no_dirt = val.at("no_dirt").get<bool>();
flags.no_shadow = val.at("no_shadow").get<bool>();
flags.no_bounce = val.at("no_bounce").get<bool>();
flags.no_minlight = val.at("no_minlight").get<bool>();
flags.no_expand = val.at("no_expand").get<bool>();
flags.light_ignore = val.at("light_ignore").get<bool>();
flags.phong_angle = val.at("phong_angle").get<vec_t>();
flags.phong_angle_concave = val.at("phong_angle_concave").get<vec_t>();
flags.minlight = val.at("minlight").get<vec_t>();
flags.minlight_color = val.at("minlight_color").get<qvec3b>();
flags.light_alpha = val.at("light_alpha").get<vec_t>();
if (val.contains("is_skip")) {
flags.is_skip = val.at("is_skip").get<bool>();
}
if (val.contains("is_hint")) {
flags.is_hint = val.at("is_hint").get<bool>();
}
if (val.contains("no_dirt")) {
flags.no_dirt = val.at("no_dirt").get<bool>();
}
if (val.contains("no_shadow")) {
flags.no_shadow = val.at("no_shadow").get<bool>();
}
if (val.contains("no_bounce")) {
flags.no_bounce = val.at("no_bounce").get<bool>();
}
if (val.contains("no_minlight")) {
flags.no_minlight = val.at("no_minlight").get<bool>();
}
if (val.contains("no_expand")) {
flags.no_expand = val.at("no_expand").get<bool>();
}
if (val.contains("light_ignore")) {
flags.light_ignore = val.at("light_ignore").get<bool>();
}
if (val.contains("phong_angle")) {
flags.phong_angle = val.at("phong_angle").get<vec_t>();
}
if (val.contains("phong_angle_concave")) {
flags.phong_angle_concave = val.at("phong_angle_concave").get<vec_t>();
}
if (val.contains("minlight")) {
flags.minlight = val.at("minlight").get<vec_t>();
}
if (val.contains("minlight_color")) {
flags.minlight_color = val.at("minlight_color").get<qvec3b>();
}
if (val.contains("light_alpha")) {
flags.light_alpha = val.at("light_alpha").get<vec_t>();
}
}
}

View File

@ -2192,11 +2192,11 @@ void WriteEntitiesToString()
for (auto &ep : entity.epairs) {
if (ep.first.size() >= options.target_game->max_entity_key - 1) {
LogPrint("WARNING: {} at {} (approx. line {}) has long key {} ({} >= {})\n", ValueForKey(&entity, "classname"), entity.origin, entity.mapbrush(0).face(0).linenum, ep.first, ep.first.size(), options.target_game->max_entity_key - 1);
LogPrint("WARNING: {} at {} (approx. line {}) has long key {} (length {} >= {})\n", ValueForKey(&entity, "classname"), entity.origin, entity.mapbrush(0).face(0).linenum, ep.first, ep.first.size(), options.target_game->max_entity_key - 1);
}
if (ep.second.size() >= options.target_game->max_entity_value - 1) {
LogPrint("WARNING: {} at {} (approx. line {}) has long value for key {} ({} >= {})\n", ValueForKey(&entity, "classname"), entity.origin, entity.mapbrush(0).face(0).linenum, ep.first, ep.second.size(), options.target_game->max_entity_value - 1);
LogPrint("WARNING: {} at {} (approx. line {}) has long value for key {} (length {} >= {})\n", ValueForKey(&entity, "classname"), entity.origin, entity.mapbrush(0).face(0).linenum, ep.first, ep.second.size(), options.target_game->max_entity_value - 1);
}
fmt::format_to(std::back_inserter(map.bsp.dentdata), "\"{}\" \"{}\"\n", ep.first, ep.second);

View File

@ -341,21 +341,49 @@ static void WriteExtendedTexinfoFlags(void)
Q_assert(count == tx.outputnum.value()); // check we are outputting them in the proper sequence
texinfofile[std::to_string(*tx.outputnum)] = {
{ "is_skip", tx.flags.is_skip },
{ "is_hint", tx.flags.is_hint },
{ "no_dirt", tx.flags.no_dirt },
{ "no_shadow", tx.flags.no_shadow },
{ "no_bounce", tx.flags.no_bounce },
{ "no_minlight", tx.flags.no_minlight },
{ "no_expand", tx.flags.no_expand },
{ "light_ignore", tx.flags.light_ignore },
{ "phong_angle", tx.flags.phong_angle },
{ "phong_angle_concave", tx.flags.phong_angle_concave },
{ "minlight", tx.flags.minlight },
{ "minlight_color", tx.flags.minlight_color },
{ "light_alpha", tx.flags.light_alpha }
};
json t = json::object();
if (tx.flags.is_skip) {
t["is_skip"] = tx.flags.is_skip;
}
if (tx.flags.is_hint) {
t["is_hint"] = tx.flags.is_hint;
}
if (tx.flags.no_dirt) {
t["no_dirt"] = tx.flags.no_dirt;
}
if (tx.flags.no_shadow) {
t["no_shadow"] = tx.flags.no_shadow;
}
if (tx.flags.no_bounce) {
t["no_bounce"] = tx.flags.no_bounce;
}
if (tx.flags.no_minlight) {
t["no_minlight"] = tx.flags.no_minlight;
}
if (tx.flags.no_expand) {
t["no_expand"] = tx.flags.no_expand;
}
if (tx.flags.light_ignore) {
t["light_ignore"] = tx.flags.light_ignore;
}
if (tx.flags.phong_angle) {
t["phong_angle"] = tx.flags.phong_angle;
}
if (tx.flags.phong_angle_concave) {
t["phong_angle_concave"] = tx.flags.phong_angle_concave;
}
if (tx.flags.minlight) {
t["minlight"] = tx.flags.minlight;
}
if (!qv::emptyExact(tx.flags.minlight_color)) {
t["minlight_color"] = tx.flags.minlight_color;
}
if (tx.flags.light_alpha) {
t["light_alpha"] = tx.flags.light_alpha;
}
texinfofile[std::to_string(*tx.outputnum)].swap(t);
count++;
}
Q_assert(count == map.bsp.texinfo.size());