MAP27 of 1FreeDoom1 megawad has visual glitch
Closed this issue · 11 comments
MAP27, next to the non-keyed wooden outdoors-to-outdoors gate, has a visual glitch where the wall which is supposed to show the sky shows a texture instead.
We’re seeing part of a “sky border” for some reason. Here is a function in builder.lua
which makes a sky border:
local function build_sky_border(side, x1,y1, x2,y2)
(This is currently around line 3540 of builder.lua
)
Some more information:
This is just above the problem square:
build_wire_fence x1=23 y1=25 x2=23 y2=33
Keep in mind:
- x is left to right
- y is bottom (low) to top (high)
Then we build a bunch of sky boxes; the relevant ones are
build_sky_border x1=15 y1=24 x2=22 y2=24
[...]
build_sky_border x1=24 y1=15 x2=24 y2=23
Point being, we need a sky_border at x=23 y=24, but we don’t ever build one there.
I’m thinking the issue is how sides are set up. I’ll see what build_one_border()
in planner.lua
sees to see the mis-match.
Some more relevant stuff:
build_one_border kind=wire x1=23 y1=25 x2=23 y2=33 (Door directly north of bug)
build_one_border kind=fence x1=25 y1=24 x2=33 y2=24 (Fence directly east of bug)
build_one_border kind=sky x1=15 y1=24 x2=22 y2=24 (Sky directly west of bug)
build_one_border kind=sky x1=24 y1=15 x2=24 y2=23 (Sky south of bug, one notch east)
Point being, this point is undefined; it’s not the part of any border.
There’s also code to build the corners....
OK, build_one_corner()
is being told to build the wrong kind of corner:
build_one_corner kind=fence x=23 y=24
Somewhat related (just one east of the problem):
build_one_corner kind=fence x=24 y=24
I suspect the bug is in the local function init_corner()
in builder.lua
This code gets really really messy. The wire fence is one to the west of the corner which should (EDIT: and indeed is) correctly be a fence, so the square one below the wire fence is never correctly marked “sky”.
Andrew’s solution with code this messy was to throw it all out and start over, which may make some sense here.
The issue here is that x=23 y=24 is an “orphan” in this map; no code figures out that this square doesn’t have a neighbor to the south.
Most likely the issue is that the side border position is one off from the corner position, but I’m just not going to go through that mess of code to figure out exactly where it happens.
Instead, I have updated the code to look for the condition in writer.lua
; if it happens, we use a hard-coded DOOM2 texture in the oblige script (Good thing the game only supports DOOM2 these days) to make the texture looks somewhat reasonable (it now looks like a very thin rock wall, instead of an ugly glowing texture). This condition only happens once when building the 1FreeDoom1
megawad.
Since this bugfix alters the generated WADs, I have also updated the tests.