use kmq2 flag instead of 33 | 66, which no engine supports

This commit is contained in:
Jonathan 2022-09-10 07:49:06 -04:00
parent a8a8966e28
commit 4ecd945587
4 changed files with 8 additions and 11 deletions

View File

@ -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
{

View File

@ -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;

View File

@ -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

View File

@ -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;
}