From c62480c337efaf297968cf27e5acaa552041faa6 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 16 Jun 2022 09:35:08 -0400 Subject: [PATCH] consistency rename; mtexinfo_t -> maptexinfo_t --- include/qbsp/map.hh | 6 +++--- include/qbsp/qbsp.hh | 6 +++--- qbsp/brush.cc | 6 +++--- qbsp/exportobj.cc | 2 +- qbsp/map.cc | 26 +++++++++++++------------- qbsp/qbsp.cc | 2 +- qbsp/surfaces.cc | 2 +- qbsp/writebsp.cc | 6 +++--- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/qbsp/map.hh b/include/qbsp/map.hh index 0ad567dc..287a66b2 100644 --- a/include/qbsp/map.hh +++ b/include/qbsp/map.hh @@ -133,10 +133,10 @@ struct mapdata_t std::vector entities; std::vector planes; std::vector miptex; - std::vector mtexinfos; + std::vector mtexinfos; /* quick lookup for texinfo */ - std::map mtexinfo_lookup; + std::map mtexinfo_lookup; /* map from plane hash code to list of indicies in `planes` vector */ std::unordered_map> planehash; @@ -204,7 +204,7 @@ inline int FindMiptex(const char *name, bool internal = false, bool recursive = std::optional extended_info; return FindMiptex(name, extended_info, internal, recursive); } -int FindTexinfo(const mtexinfo_t &texinfo); +int FindTexinfo(const maptexinfo_t &texinfo); void PrintEntity(const mapentity_t *entity); diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index f2a63077..7d617d79 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -290,7 +290,7 @@ constexpr double SIDESPACE = 24.0; #include #include -struct mtexinfo_t +struct maptexinfo_t { texvecf vecs; /* [s/t][xyz offset] */ int32_t miptex = 0; @@ -301,9 +301,9 @@ struct mtexinfo_t constexpr auto as_tuple() const { return std::tie(vecs, miptex, flags, value, next); } - constexpr bool operator<(const mtexinfo_t &other) const { return as_tuple() < other.as_tuple(); } + constexpr bool operator<(const maptexinfo_t &other) const { return as_tuple() < other.as_tuple(); } - constexpr bool operator>(const mtexinfo_t &other) const { return as_tuple() > other.as_tuple(); } + constexpr bool operator>(const maptexinfo_t &other) const { return as_tuple() > other.as_tuple(); } }; class mapentity_t; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 988510c3..78496f26 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -376,7 +376,7 @@ static std::vector CreateBrushFaces(const mapentity_t *src, hullbrush_t for (auto &mapface : hullbrush->faces) { if (hullnum <= 0 && Brush_IsHint(*hullbrush)) { /* Don't generate hintskip faces */ - const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); + const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); if (options.target_game->texinfo_is_hintskip(texinfo.flags, map.miptexTextureName(texinfo.miptex))) continue; @@ -430,7 +430,7 @@ static std::vector CreateBrushFaces(const mapentity_t *src, hullbrush_t // account for texture offset, from txqbsp-xt if (!options.oldrottex.value()) { - mtexinfo_t texInfoNew = map.mtexinfos.at(mapface.texinfo); + maptexinfo_t texInfoNew = map.mtexinfos.at(mapface.texinfo); texInfoNew.outputnum = std::nullopt; texInfoNew.vecs.at(0, 3) += qv::dot(rotate_offset, texInfoNew.vecs.row(0).xyz()); @@ -720,7 +720,7 @@ static contentflags_t Brush_GetContents(const mapbrush_t *mapbrush) // validate that all of the sides have valid contents for (int i = 0; i < mapbrush->numfaces; i++) { const mapface_t &mapface = mapbrush->face(i); - const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); + const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); contentflags_t contents = options.target_game->face_get_contents(mapface.texname.data(), texinfo.flags, mapface.contents); diff --git a/qbsp/exportobj.cc b/qbsp/exportobj.cc index d9f7bbc1..5fb7ceac 100644 --- a/qbsp/exportobj.cc +++ b/qbsp/exportobj.cc @@ -54,7 +54,7 @@ static std::ofstream InitMtlFile(const std::string &filesuffix) static void ExportObjFace(std::ofstream &f, const face_t *face, int *vertcount) { - const mtexinfo_t &texinfo = map.mtexinfos.at(face->texinfo); + const maptexinfo_t &texinfo = map.mtexinfos.at(face->texinfo); const char *texname = map.miptexTextureName(texinfo.miptex).c_str(); const texture_t *texture = WADList_GetTexture(texname); diff --git a/qbsp/map.cc b/qbsp/map.cc index 268fe11a..ffbcc4c6 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -299,7 +299,7 @@ FindTexinfo Returns a global texinfo number =============== */ -int FindTexinfo(const mtexinfo_t &texinfo) +int FindTexinfo(const maptexinfo_t &texinfo) { // NaN's will break mtexinfo_lookup, since they're being used as a std::map key and don't compare properly with <. // They should have been stripped out already in ValidateTextureProjection. @@ -320,12 +320,12 @@ int FindTexinfo(const mtexinfo_t &texinfo) map.mtexinfos.emplace_back(texinfo); map.mtexinfo_lookup[texinfo] = num_texinfo; - // catch broken < implementations in mtexinfo_t + // catch broken < implementations in maptexinfo_t assert(map.mtexinfo_lookup.find(texinfo) != map.mtexinfo_lookup.end()); // create a copy of the miptex for animation chains if (map.miptex[texinfo.miptex].animation_miptex != -1) { - mtexinfo_t anim_next = texinfo; + maptexinfo_t anim_next = texinfo; anim_next.miptex = map.miptex[texinfo.miptex].animation_miptex; @@ -335,7 +335,7 @@ int FindTexinfo(const mtexinfo_t &texinfo) return num_texinfo; } -static surfflags_t SurfFlagsForEntity(const mtexinfo_t &texinfo, const mapentity_t *entity) +static surfflags_t SurfFlagsForEntity(const maptexinfo_t &texinfo, const mapentity_t *entity) { surfflags_t flags{}; const char *texname = map.miptex.at(texinfo.miptex).name.c_str(); @@ -949,7 +949,7 @@ static void SetTexinfo_QuakeEd_New( } static void SetTexinfo_QuakeEd(const qbsp_plane_t &plane, const std::array &planepts, const qvec2d &shift, - const vec_t &rotate, const qvec2d &scale, mtexinfo_t *out) + const vec_t &rotate, const qvec2d &scale, maptexinfo_t *out) { int i, j; qvec3d vecs[2]; @@ -1033,7 +1033,7 @@ static void SetTexinfo_QuakeEd(const qbsp_plane_t &plane, const std::array &planepts, texcoord_style_t style, mtexinfo_t *out) + parser_t &parser, const std::array &planepts, texcoord_style_t style, maptexinfo_t *out) { int i; qvec3d vecs[2]; @@ -1095,7 +1095,7 @@ static void SetTexinfo_QuArK( out->vecs.at(1, 3) = -qv::dot(vecs[1], planepts[0]); } -static void SetTexinfo_Valve220(qmat &axis, const qvec2d &shift, const qvec2d &scale, mtexinfo_t *out) +static void SetTexinfo_Valve220(qmat &axis, const qvec2d &shift, const qvec2d &scale, maptexinfo_t *out) { int i; @@ -1299,7 +1299,7 @@ parse_error: FError("line {}: couldn't parse Brush Primitives texture info", parser.linenum); } -static void ParseTextureDef(parser_t &parser, mapface_t &mapface, const mapbrush_t *brush, mtexinfo_t *tx, +static void ParseTextureDef(parser_t &parser, mapface_t &mapface, const mapbrush_t *brush, maptexinfo_t *tx, std::array &planepts, const qbsp_plane_t &plane) { vec_t rotate; @@ -1459,7 +1459,7 @@ const texvecf &mapface_t::get_texvecs() const void mapface_t::set_texvecs(const texvecf &vecs) { // start with a copy of the current texinfo structure - mtexinfo_t texInfoNew = map.mtexinfos.at(this->texinfo); + maptexinfo_t texInfoNew = map.mtexinfos.at(this->texinfo); texInfoNew.outputnum = std::nullopt; texInfoNew.vecs = vecs; this->texinfo = FindTexinfo(texInfoNew); @@ -1484,12 +1484,12 @@ bool IsValidTextureProjection(const qvec3f &faceNormal, const qvec3f &s_vec, con return true; } -inline bool IsValidTextureProjection(const mapface_t &mapface, const mtexinfo_t *tx) +inline bool IsValidTextureProjection(const mapface_t &mapface, const maptexinfo_t *tx) { return IsValidTextureProjection(mapface.plane.normal, tx->vecs.row(0).xyz(), tx->vecs.row(1).xyz()); } -static void ValidateTextureProjection(mapface_t &mapface, mtexinfo_t *tx) +static void ValidateTextureProjection(mapface_t &mapface, maptexinfo_t *tx) { if (!IsValidTextureProjection(mapface, tx)) { logging::print("WARNING: repairing invalid texture projection on line {} (\"{}\" near {} {} {})\n", mapface.linenum, @@ -1509,7 +1509,7 @@ static std::unique_ptr ParseBrushFace(parser_t &parser, const mapbrus { std::array planepts; bool normal_ok; - mtexinfo_t tx; + maptexinfo_t tx; int i, j; std::unique_ptr face{new mapface_t}; @@ -2009,7 +2009,7 @@ static void ConvertMapFace(std::ofstream &f, const mapface_t &mapface, const con EnsureTexturesLoaded(); const texture_t *texture = WADList_GetTexture(mapface.texname.c_str()); - const mtexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); + const maptexinfo_t &texinfo = map.mtexinfos.at(mapface.texinfo); // Write plane points for (int i = 0; i < 3; i++) { diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index 5db2c3e8..f065714d 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -1284,7 +1284,7 @@ MakeSkipTexinfo */ static int MakeSkipTexinfo() { - mtexinfo_t mt{}; + maptexinfo_t mt{}; mt.miptex = FindMiptex("skip", true); mt.flags.is_skip = true; diff --git a/qbsp/surfaces.cc b/qbsp/surfaces.cc index 5f176ece..a6e9554b 100644 --- a/qbsp/surfaces.cc +++ b/qbsp/surfaces.cc @@ -60,7 +60,7 @@ std::list SubdivideFace(face_t *f) int axis; qbsp_plane_t plane; face_t *front, *back; - const mtexinfo_t *tex; + const maptexinfo_t *tex; vec_t subdiv; vec_t extent; int lmshift; diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index 67b3e5a8..7833c712 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -56,7 +56,7 @@ size_t ExportMapPlane(size_t planenum) size_t ExportMapTexinfo(size_t texinfonum) { - mtexinfo_t &src = map.mtexinfos.at(texinfonum); + maptexinfo_t &src = map.mtexinfos.at(texinfonum); if (src.outputnum.has_value()) return src.outputnum.value(); @@ -313,9 +313,9 @@ static void WriteExtendedTexinfoFlags(void) return; // sort by output texinfo number - std::vector texinfos_sorted(map.mtexinfos); + std::vector texinfos_sorted(map.mtexinfos); std::sort(texinfos_sorted.begin(), texinfos_sorted.end(), - [](const mtexinfo_t &a, const mtexinfo_t &b) { return a.outputnum < b.outputnum; }); + [](const maptexinfo_t &a, const maptexinfo_t &b) { return a.outputnum < b.outputnum; }); json texinfofile = json::object();