Redesigned algorithms for reading PNAME patch definitions and TEXTURE1/2 texture definitions.
Unfortunately, due to the DOOM engine only using the last found TEXTURE1/2 lumps in order to add new texture definitions a mod authors would typically duplicate the IWAD originals and then append their new definitions. This breaks our logic which decides whether a texture is IWAD-original as we assume that if the definition lump isn't, then all textures it contains arn't. The result being that when a PWAD that makes use of custom texturs is played; numerous problems would occur such as detail textures being used where they shouldn't light decorations not working even though the defined texture hasn't changed etc, etc...
This new algorithm will first load the last found PNAMES lump. Then, ALL loaded TEXTURE1/2 lumps are parsed for new texture definitions, sorted into two lists depending on whether the definition lump is from an IWAD or not. Then the two lists are cross merged/compared to determine which definitions in the non-IWAD lumps should be treated as IWAD definitions. If a duplicate is found, the equivalent IWAD original definition is purged and the newer definition overrides. However, it will now be treated as if it were defined in an IWAD.
Todo: This algorithm probably isn't as efficient as it could be. The goal was to fix the problem(s) with the old method. However, it is a lot more robust in that truncated lumps, invalid definitions and other problems no longer result in an error message plus engine shutdown.
Redesigned algorithms for reading PNAME patch definitions and TEXTURE1/2 texture definitions.
Unfortunately, due to the DOOM engine only using the last found TEXTURE1/2 lumps in order to add new texture definitions a mod authors would typically duplicate the IWAD originals and then append their new definitions. This breaks our logic which decides whether a texture is IWAD-original as we assume that if the definition lump isn't, then all textures it contains arn't. The result being that when a PWAD that makes use of custom texturs is played; numerous problems would occur such as detail textures being used where they shouldn't light decorations not working even though the defined texture hasn't changed etc, etc...
This new algorithm will first load the last found PNAMES lump. Then, ALL loaded TEXTURE1/2 lumps are parsed for new texture definitions, sorted into two lists depending on whether the definition lump is from an IWAD or not. Then the two lists are cross merged/compared to determine which definitions in the non-IWAD lumps should be treated as IWAD definitions. If a duplicate is found, the equivalent IWAD original definition is purged and the newer definition overrides. However, it will now be treated as if it were defined in an IWAD.
Todo: This algorithm probably isn't as efficient as it could be. The goal was to fix the problem(s) with the old method. However, it is a lot more robust in that truncated lumps, invalid definitions and other problems no longer result in an error message plus engine shutdown.