fabiangreffrath / woof

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

Missing ceiling flats default to f_sky and cause rendering inconsistencies with dsda-doom #1540

Closed dististik closed 8 months ago

dististik commented 8 months ago

If a sector's ceiling flat is not set, Woof interprets them as F_SKY. This creates some inconsistencies with how 0-height sectors are rendered between DSDA-Doom and Woof, as if the ceiling flat is missing in DSDA-Doom it will still render the linedef's textures where Woof will not (instead rendering it as a patch of sky as it would if the flat was set to F_SKY). While this is firstly a mapping error, as the sector should either be deleted or have it's flat set in case, I figured it wouldn't hurt to bring it up due to the inconsistencies between ports (and completely understand if this is a wont fix).

Screenshot example:

Found in Doomworld Dating Simulator RC0 MAP15 (both when the map was built with ZDBSP and ZenNode).

fabiangreffrath commented 8 months ago
diff --git a/src/r_data.c b/src/r_data.c
index 0d82d235..160a2005 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -1050,9 +1050,8 @@ int R_FlatNumForName(const char *name)    // killough -- const added
   int i = (W_CheckNumForName)(name, ns_flats);
   if (i == -1)
   {
-    // [FG] render missing flats as SKY
     I_Printf(VB_WARNING, "R_FlatNumForName: %.8s not found", name);
-    return skyflatnum;
+    return i;
   }
   return i - firstflat;
 }
@@ -1124,7 +1123,12 @@ void R_PrecacheLevel(void)
   memset(hitlist, 0, numflats);

   for (i = numsectors; --i >= 0; )
-    hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1;
+  {
+    if (sectors[i].floorpic >= 0)
+        hitlist[sectors[i].floorpic] = 1;
+    if (sectors[i].ceilingpic >= 0)
+        hitlist[sectors[i].ceilingpic] = 1;
+  }

   for (i = numflats; --i >= 0; )
     if (hitlist[i])
diff --git a/src/r_plane.c b/src/r_plane.c
index aabfacb7..5c76e9a5 100644
--- a/src/r_plane.c
+++ b/src/r_plane.c
@@ -304,6 +304,9 @@ visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel,
   visplane_t *check;
   unsigned hash;                      // killough

+  if (picnum == -1)
+    return NULL;
+
   if (picnum == skyflatnum || picnum & PL_SKYFLAT)  // killough 10/98
   {
     lightlevel = 0;   // killough 7/19/98: most skies map together
rfomin commented 8 months ago

This patch works for me. Should we use something like NO_INDEX or NO_TEXTURE for -1?

I think we should fix this, it works in PrBoom+/Eternity/ZDoom.

fabiangreffrath commented 8 months ago

Good idea. Though, NO_INDEX is already defined as (unsigned short) -1.