fabiangreffrath / woof

Woof! is a continuation of the Boom/MBF bloodline of Doom source ports.
GNU General Public License v2.0
212 stars 36 forks source link

Vibrating textures with uncapped framerate [scroller with no tag] #1218

Closed kitchen-ace closed 1 year ago

kitchen-ace commented 1 year ago

This map, needs the resource pack. Almost all textures look like they're vibrating when you get up close.

It might be a stray scroller linedef because the effect doesn't happen with -complevel vanilla. However no other port I've tried has the same issue. (DSDA-Doom, GZDoom, Eternity, PrBoom+.)

https://www.dropbox.com/s/mfar7qtnpf5903i/Mayhem23cb.wad?dl=0 https://www.doomworld.com/applications/core/interface/file/attachment.php?id=237088

kitchen-ace commented 1 year ago

Yeah it is a scroller, there are 16 linedefs with action 254 (Scroll Tagged Wall, Same as Floor/Ceiling) and no tag which other ports seem to treat as "just scroll this wall" but which Woof is applying to all linedefs without a tag.

kitchen-ace commented 1 year ago

After playing with this a bit more, I think the vectors for all the scrollers are cancelling each other out, producing no texture movement in other ports. A single untagged 254 linedef will scroll all other untagged walls, however two opposite ones will not, even in original DOS versions of MBF and Boom.

Since the problem goes away with uncapped framerate off, maybe it's an interpolation problem?

Here's a test wad that shows the problem more easily. scr254ax.zip

rfomin commented 1 year ago

Since the problem goes away with uncapped framerate off, maybe it's an interpolation problem?

Yes, it's an interpolation problem, thanks for the report.

Ugly fix:

diff --git a/src/p_spec.c b/src/p_spec.c
index 9d0b781..65d96cc 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -2644,8 +2644,11 @@ void T_Scroll(scroll_t *s)
         side = sides + s->affectee;
         side->basetextureoffset += dx;
         side->baserowoffset += dy;
-        side->textureoffset = side->basetextureoffset;
-        side->rowoffset = side->baserowoffset;
+        if (!uncapped)
+        {
+          side->textureoffset = side->basetextureoffset;
+          side->rowoffset = side->baserowoffset;
+        }
         break;

     case sc_floor:                  // killough 3/7/98: Scroll floor texture
@@ -2760,8 +2763,10 @@ void R_InterpolateTextureOffsets (void)

         case sc_side:
           side = sides + s->affectee;
-          side->textureoffset = side->basetextureoffset + FixedMul(dx, fractionaltic);
-          side->rowoffset = side->baserowoffset + FixedMul(dy, fractionaltic);
+          if (side->textureoffset != side->basetextureoffset)
+            side->textureoffset = side->basetextureoffset + FixedMul(dx, fractionaltic);
+          if (side->rowoffset != side->baserowoffset)
+            side->rowoffset = side->baserowoffset + FixedMul(dy, fractionaltic);
           break;
         case sc_floor:
           sec = sectors + s->affectee;
fabiangreffrath commented 1 year ago

Thanks for the fix @rfomin! Feel free to file a PR please or apply directly if you feel confident.

fabiangreffrath commented 1 year ago

Okay, part of the issue seems to be that in Vanilla, the textureoffset value is updated once per tic (in P_UpdateSpecials()), whereas in MBF it is updated once per thinker (in T_Scroll())