diff --git a/common/bspfile.cc b/common/bspfile.cc index 3efcfb60..85f9cb4d 100644 --- a/common/bspfile.cc +++ b/common/bspfile.cc @@ -888,7 +888,9 @@ struct gamedef_q2_t : public gamedef_t } static constexpr const char *surf_bitflag_names[] = { - "LIGHT", "SLICK", "SKY", "WARP", "TRANS33", "TRANS66", "FLOWING", "NODRAW", "HINT"}; + "LIGHT", "SLICK", "SKY", "WARP", "TRANS33", "TRANS66", "FLOWING", "NODRAW", + "HINT", "512", "1024", "2048", "4096", "8192", "16384", "32768", "65536", + "131072", "262144", "524288", "1048576", "2097152", "4194304", "8388608", "16777216", "ALPHATEST" }; int32_t surfflags_from_string(const std::string_view &str) const override { diff --git a/common/bsputils.cc b/common/bsputils.cc index d45297ae..27b2121a 100644 --- a/common/bsputils.cc +++ b/common/bsputils.cc @@ -207,9 +207,7 @@ bool // mxd ContentsOrSurfaceFlags_IsTranslucent(const mbsp_t *bsp, const int contents_or_surf_flags) { if (bsp->loadversion->game->id == GAME_QUAKE_II) - return (contents_or_surf_flags & Q2_SURF_TRANSLUCENT) && - ((contents_or_surf_flags & Q2_SURF_TRANSLUCENT) != - Q2_SURF_TRANSLUCENT); // Don't count KMQ2 fence flags combo as translucent + return (contents_or_surf_flags & (Q2_SURF_TRANS33 | Q2_SURF_TRANS66)); else return contents_or_surf_flags == CONTENTS_WATER || contents_or_surf_flags == CONTENTS_LAVA || contents_or_surf_flags == CONTENTS_SLIME; diff --git a/include/common/bspfile_q2.hh b/include/common/bspfile_q2.hh index 3cc5ae2d..6cefbffa 100644 --- a/include/common/bspfile_q2.hh +++ b/include/common/bspfile_q2.hh @@ -192,7 +192,7 @@ enum q2_surf_flags_t : int32_t Q2_SURF_HINT = nth_bit(8), // make a primary bsp splitter Q2_SURF_SKIP = nth_bit(9), // ONLY FOR HINT! "nodraw" = Q1 "skip" - Q2_SURF_TRANSLUCENT = (Q2_SURF_TRANS33 | Q2_SURF_TRANS66), // mxd + Q2_SURF_ALPHATEST = nth_bit(25), // Paril, KMQ2 flag }; struct q2_texinfo_t diff --git a/light/trace_embree.cc b/light/trace_embree.cc index df3d2acc..81eb037e 100644 --- a/light/trace_embree.cc +++ b/light/trace_embree.cc @@ -134,10 +134,8 @@ sceneinfo CreateGeometry( // mxd if (bsp->loadversion->game->id == GAME_QUAKE_II) { const int surf_flags = Face_ContentsOrSurfaceFlags(bsp, face); - info.is_fence = - ((surf_flags & Q2_SURF_TRANSLUCENT) == - Q2_SURF_TRANSLUCENT); // KMQuake 2-specific. Use texture alpha chanel when both flags are set. - info.is_glass = !info.is_fence && (surf_flags & Q2_SURF_TRANSLUCENT); + info.is_fence = surf_flags & Q2_SURF_ALPHATEST; + info.is_glass = !info.is_fence && (surf_flags & (Q2_SURF_TRANS33 | Q2_SURF_TRANS66)); if (info.is_glass) { info.alpha = (surf_flags & Q2_SURF_TRANS33 ? 0.33f : 0.66f); } @@ -494,8 +492,7 @@ void Embree_TraceInit(const mbsp_t *bsp) // handle glass / water const float alpha = Face_Alpha(model, face); if (alpha < 1.0f || - (is_q2 && (contents_or_surf_flags & Q2_SURF_TRANSLUCENT))) { // mxd. Both fence and transparent textures - // are done using SURF_TRANS flags in Q2 + (is_q2 && (contents_or_surf_flags & (Q2_SURF_ALPHATEST | Q2_SURF_TRANS33 | Q2_SURF_TRANS66)))) { filterfaces.push_back(face); continue; }