Doom and Doom 2's skies use the same texture names, but not the same patch names. I resolve this conflict in the IWAD that WadSmoosh generates by renaming the Doom 2 sky textures to RSKY1/2/3 (the same name as the patches they use), and handling custom PWAD skies with some ZScript that detects whether the sky is custom (details below), and setting it on WorldLoaded. As of the 1.2 release last month, this code has correctly handled everything I've thrown at it.
I noticed today that maps 21-30 of Requiem (1997) display a missing texture for the sky using the WadSmoosh IWAD. This issue seems subtle and unrelated to the previous compat challenges I was fixing. I pared down the relevant content and zscript to a minimal example case, ZIP is attached.
To reproduce the issue I'm seeing using only the ZIP (ie without needing to touch WadSmoosh), run this:
Code: Select all
gzdoom -iwad doom2.wad -file skytest.pk3 req2.wad -warp 21
This will load you into vanilla Doom 2 MAP21, with a clear view of the sky overhead, but the sky is the white-and-blue missing texture.
Now run this, using another example WAD (based on Alien Vendetta) with a very similiar setup, but works as expected:
Code: Select all
gzdoom -iwad doom2.wad -file skytest.pk3 av2.wad -warp 21
This time MAP21 has the correct, custom sky.
Strangely, loading up map15 (which uses SKY2) provides the correct result with both example wads.
The core of WadSmoosh's Doom 2 custom sky detection is this:
Code: Select all
TextureID skyA = TexMan.CheckForTexture("SKY3", TexMan.Type_Any, TexMan.Type_Any);
TextureID skyB = TexMan.CheckForTexture("SKY3", TexMan.Type_Override, TexMan.Type_Any);
if ( skyA == skyB )
return; // do nothing
level.ChangeSky(skyA, skyA);
Basically it checks what it gets for two different namespaces, and if they're different, SKY# must be getting overridden, so use that instead.
For all other WADs, including the av2.wad example provided, the skyA TextureID comes back as a valid (non-zero) value. For the req2.wad example, the skyA TextureID is 0, and I can't figure out why. This is what has me wondering if it's a bug with GZDoom. Maybe req2.wad's similar SKY3 patch names (RSKY31, RSKY32, RSKY33) aren't getting handled correctly deep in some asset loading code? Maybe I'm misusing CheckForTexture? I'm not super familiar with the nuances of texture namespaces. Any ideas?
Doom and Doom 2's skies use the same texture names, but not the same patch names. I resolve this conflict in the IWAD that WadSmoosh generates by renaming the Doom 2 sky textures to RSKY1/2/3 (the same name as the patches they use), and handling custom PWAD skies with some ZScript that detects whether the sky is custom (details below), and setting it on WorldLoaded. As of the 1.2 release last month, this code has correctly handled everything I've thrown at it.
I noticed today that maps 21-30 of Requiem (1997) display a missing texture for the sky using the WadSmoosh IWAD. This issue seems subtle and unrelated to the previous compat challenges I was fixing. I pared down the relevant content and zscript to a minimal example case, ZIP is attached.
To reproduce the issue I'm seeing using only the ZIP (ie without needing to touch WadSmoosh), run this:
[code]gzdoom -iwad doom2.wad -file skytest.pk3 req2.wad -warp 21[/code]
This will load you into vanilla Doom 2 MAP21, with a clear view of the sky overhead, but the sky is the white-and-blue missing texture.
Now run this, using another example WAD (based on Alien Vendetta) with a very similiar setup, but works as expected:
[code]gzdoom -iwad doom2.wad -file skytest.pk3 av2.wad -warp 21[/code]
This time MAP21 has the correct, custom sky.
Strangely, loading up map15 (which uses SKY2) provides the correct result with both example wads.
The core of WadSmoosh's Doom 2 custom sky detection is this:
[code]
TextureID skyA = TexMan.CheckForTexture("SKY3", TexMan.Type_Any, TexMan.Type_Any);
TextureID skyB = TexMan.CheckForTexture("SKY3", TexMan.Type_Override, TexMan.Type_Any);
if ( skyA == skyB )
return; // do nothing
level.ChangeSky(skyA, skyA);
[/code]
Basically it checks what it gets for two different namespaces, and if they're different, SKY# must be getting overridden, so use that instead.
For all other WADs, including the av2.wad example provided, the skyA TextureID comes back as a valid (non-zero) value. For the req2.wad example, the skyA TextureID is 0, and I can't figure out why. This is what has me wondering if it's a bug with GZDoom. Maybe req2.wad's similar SKY3 patch names (RSKY31, RSKY32, RSKY33) aren't getting handled correctly deep in some asset loading code? Maybe I'm misusing CheckForTexture? I'm not super familiar with the nuances of texture namespaces. Any ideas?