From ed7a6845838388fe08dbb1bfb4d35ef1c58130a7 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 28 May 2023 11:43:30 -0600 Subject: [PATCH] qbsp: remove dead code contents_are_mirrored() --- common/bspfile.cc | 35 ++--------------------------------- include/common/bspfile.hh | 2 -- qbsp/faces.cc | 18 ------------------ 3 files changed, 2 insertions(+), 53 deletions(-) diff --git a/common/bspfile.cc b/common/bspfile.cc index 13f64d11..96176f45 100644 --- a/common/bspfile.cc +++ b/common/bspfile.cc @@ -494,18 +494,6 @@ public: return bits.detail && bits.mist; } - bool contents_are_mirrored(const contentflags_t &contents) const override - { - const auto bits = contentflags_to_bits(contents); - if (bits.mirror_inside) - return true; - - const auto visible = bits.visible_contents(); - - // If the brush is non-solid, mirror faces for the inside view - return visible.water || visible.slime || visible.lava; - } - bool contents_are_origin(const contentflags_t &contents) const override { // fixme-brushbsp: document whether this is an exclusive test (i.e. what does it return for water|origin) @@ -1129,19 +1117,6 @@ struct gamedef_q2_t : public gamedef_t return ((contents.native & mist1_type) == mist1_type) || ((contents.native & mist2_type) == mist2_type); } - bool contents_are_mirrored(const contentflags_t &contents) const override - { - // if we have mirrorinside set, go ahead - if (contents.mirror_inside.has_value()) - return contents.mirror_inside.value(); - - // Q2 is a bit different here. in vanilla tools, - // every content except SOLID and WINDOW is implicitly mirrorinside. - // the only exception is that 4bsp has the unused AUX - // contents to default to not mirroring the insides. - return !(contents.native & (Q2_CONTENTS_SOLID | Q2_CONTENTS_AUX)); - } - bool contents_are_origin(const contentflags_t &contents) const override { return contents.native & Q2_CONTENTS_ORIGIN; @@ -1867,11 +1842,6 @@ bool contentflags_t::is_detail_illusionary(const gamedef_t *game) const return game->contents_are_detail_illusionary(*this); } -bool contentflags_t::is_mirrored(const gamedef_t *game) const -{ - return game->contents_are_mirrored(*this); -} - contentflags_t &contentflags_t::set_mirrored(const std::optional &mirror_inside_value) { mirror_inside = mirror_inside_value; @@ -1943,9 +1913,8 @@ std::string contentflags_t::to_string(const gamedef_t *game) const { std::string s = game->get_contents_display(*this); - if (contentflags_t{native}.is_mirrored(game) != is_mirrored(game)) { - s += fmt::format( - " | MIRROR_INSIDE[{}]", mirror_inside.has_value() ? (mirror_inside.value() ? "true" : "false") : "nullopt"); + if (mirror_inside != std::nullopt) { + s += fmt::format(" | MIRROR_INSIDE[{}]", mirror_inside.value() ? "true" : "false"); } if (contentflags_t{native}.will_clip_same_type(game) != will_clip_same_type(game)) { diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index 10636ee2..056f1b13 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -115,7 +115,6 @@ struct contentflags_t bool is_detail_fence(const gamedef_t *game) const; bool is_detail_illusionary(const gamedef_t *game) const; - bool is_mirrored(const gamedef_t *game) const; contentflags_t &set_mirrored(const std::optional &mirror_inside_value); inline bool will_clip_same_type(const gamedef_t *game) const { return will_clip_same_type(game, *this); } @@ -314,7 +313,6 @@ struct gamedef_t virtual bool contents_are_detail_wall(const contentflags_t &contents) const = 0; virtual bool contents_are_detail_fence(const contentflags_t &contents) const = 0; virtual bool contents_are_detail_illusionary(const contentflags_t &contents) const = 0; - virtual bool contents_are_mirrored(const contentflags_t &contents) const = 0; virtual bool contents_are_origin(const contentflags_t &contents) const = 0; virtual bool contents_are_clip(const contentflags_t &contents) const = 0; virtual bool contents_are_empty(const contentflags_t &contents) const = 0; diff --git a/qbsp/faces.cc b/qbsp/faces.cc index 75440e22..c50467a0 100644 --- a/qbsp/faces.cc +++ b/qbsp/faces.cc @@ -473,24 +473,6 @@ static std::unique_ptr FaceFromPortal(portal_t *p, bool pside) f->portal = p; f->original_side = side->source; -#if 0 - bool make_face = - qbsp_options.target_game->directional_visible_contents(p->nodes[pside]->contents, p->nodes[!pside]->contents); - if (!make_face) { - // content type / game rules requested to skip generating a face on this side - return nullptr; - } - - if (!p->nodes[pside]->contents.is_empty(qbsp_options.target_game)) { - bool our_contents_mirrorinside = qbsp_options.target_game->contents_are_mirrored(p->nodes[pside]->contents); - if (!our_contents_mirrorinside) { - if (side->plane_flipped != pside) { - return nullptr; - } - } - } -#endif - if (pside) { f->w = p->winding.flip(); } else {