diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 8a78826a9..1d17ba4ab 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -233,6 +233,12 @@ Note: All fields default to false unless mentioned otherwise. lm_sampledist_top = ; // ZDRay customizable sampling distance for this sidedef's top part. Defines the map units each lightmap texel covers. Must be in powers of two. Default = 0 lm_sampledist_mid = ; // ZDRay customizable sampling distance for this sidedef's middle part. Defines the map units each lightmap texel covers. Must be in powers of two. Default = 0 lm_sampledist_bot = ; // ZDRay customizable sampling distance for this sidedef's bottom part. Defines the map units each lightmap texel covers. Must be in powers of two. Default = 0 + + skew_top = ; // enables skewing of wall textures, the skewing angle will be aligned to one of the 4 planes touching the floor. + skew_middle = ; // Vertical texture alignment defines the position at the leftmost point of the wall. + skew_bottom = ; // Possible values: 0 = no skewing, 1 = align to front floor, 2 = align to front ceiling, 3 = align to back floor, 4 = align to back ceiling. + // Front/Back are relative to the sidedef, not the owning linedef. Default = 0. + } sector @@ -542,6 +548,9 @@ Added/updated ZDRay/lightmap-related properties. 1.35 15.09.2023 fixed omissions: Blocklandmonsters and Blockfloaters line flags. +1.36 20.10.2023 +Sidedef skewing properties + =============================================================================== EOF =============================================================================== diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index 0517b0f93..c05550b54 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -1197,14 +1197,10 @@ struct side_t enum ESkew { skew_none = 0, - skew_front = 1, - skew_back = 2, - // for mid textures there's 4 options skew_front_floor = 1, skew_front_ceiling = 2, skew_back_floor = 3, skew_back_ceiling = 4 - }; struct part diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index abd1fabbf..bb6f43d59 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -104,6 +104,7 @@ static char HexenSectorSpecialOk[256]={ 1,1,1,1,1, }; +#if 0 static const char* udmfsolidskewtypes[] = { "none", @@ -121,6 +122,7 @@ static const char* udmfmaskedskewtypes[] = "back_ceiling", nullptr }; +#endif static inline bool P_IsThingSpecial(int specnum) { @@ -1516,6 +1518,7 @@ public: CHECK_N(Zd | Zdt) break; +#if 0 // specs are to rough and too vague - needs to be cleared first how this works. case NAME_skew_top_type: CHECK_N(Zd | Zdt) sd->textures[side_t::top].skew = MatchString(key, udmfsolidskewtypes, 0); @@ -1530,7 +1533,22 @@ public: CHECK_N(Zd | Zdt) sd->textures[side_t::bottom].skew = MatchString(key, udmfsolidskewtypes, 0); break; +#endif + case NAME_skew_top: + CHECK_N(Zd | Zdt) + sd->textures[side_t::top].skew = CheckInt(key); + break; + + case NAME_skew_middle: + CHECK_N(Zd | Zdt) + sd->textures[side_t::mid].skew = CheckInt(key); + break; + + case NAME_skew_bottom: + CHECK_N(Zd | Zdt) + sd->textures[side_t::bottom].skew = CheckInt(key); + break; default: if (strnicmp("user_", key.GetChars(), 5)) @@ -2248,6 +2266,7 @@ public: sides[side].sector = &Level->sectors[intptr_t(sides[side].sector)]; lines[line].sidedef[sd] = &sides[side]; +#if 0 if (sd == 1) { // fix flags for backside. The definition is linedef relative, not sidedef relative. @@ -2258,6 +2277,7 @@ public: sides[side].textures[side_t::bottom].skew = swaps[sides[side].textures[side_t::bottom].skew]; sides[side].textures[side_t::mid].skew = swapsm[sides[side].textures[side_t::mid].skew]; } +#endif loader->ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside], lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex); diff --git a/src/namedef_custom.h b/src/namedef_custom.h index 9d1c2e22b..e09fdbbd3 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -861,5 +861,8 @@ xx(lm_sampledistance) xx(skew_bottom_type) xx(skew_middle_type) xx(skew_top_type) +xx(skew_bottom) +xx(skew_middle) +xx(skew_top) xx(Corona) diff --git a/src/rendering/hwrenderer/scene/hw_walls.cpp b/src/rendering/hwrenderer/scene/hw_walls.cpp index 5e0048545..6946f6b43 100644 --- a/src/rendering/hwrenderer/scene/hw_walls.cpp +++ b/src/rendering/hwrenderer/scene/hw_walls.cpp @@ -2280,11 +2280,27 @@ void HWWall::Process(HWWallDispatcher *di, seg_t *seg, sector_t * frontsector, s if (texture && texture->isValid()) { int skewflag = seg->sidedef->textures[side_t::top].skew; + float skew; if (skewflag == 0) skewflag = topskew; - float skew = - skewflag == side_t::skew_front ? fch2 - fch1 : - skewflag == side_t::skew_back ? bch2 - bch1 : 0.; + switch (skewflag) + { + default: + skew = 0; + break; + case side_t::skew_front_ceiling: + skew = fch2 - fch1; + break; + case side_t::skew_back_ceiling: + skew = bch2 - bch1; + break; + case side_t::skew_front_floor: + skew = bfh2 - bfh1; + break; + case side_t::skew_back_floor: + skew = ffh2 - ffh1; + break; + } DoTexture(di, RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0, crefz, realback->GetPlaneTexZ(sector_t::ceiling), fch1, fch2, bch1a, bch2a, 0, skew); @@ -2407,9 +2423,25 @@ void HWWall::Process(HWWallDispatcher *di, seg_t *seg, sector_t * frontsector, s { int skewflag = seg->sidedef->textures[side_t::bottom].skew; if (skewflag == 0) skewflag = bottomskew; - float skew = - skewflag == side_t::skew_back ? bfh2a - bfh1a : - skewflag == side_t::skew_front ? ffh2 - ffh1 : 0.; + float skew; + switch (skewflag) + { + default: + skew = 0; + break; + case side_t::skew_front_ceiling: + skew = fch2 - fch1; + break; + case side_t::skew_back_ceiling: + skew = bch2 - bch1; + break; + case side_t::skew_front_floor: + skew = bfh2a - bfh1a; + break; + case side_t::skew_back_floor: + skew = ffh2 - ffh1; + break; + } DoTexture(di, RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0, realback->GetPlaneTexZ(sector_t::floor), frefz,