Fox, on 22 February 2014 - 06:56 PM, said:
Would it be possible to automatically remap all lookup tables to transform color 255 into 0? That would effectively solve some problems. It would fix the glitch involving translucent textures over a wall/floor textures that uses the transparent/magenta color. Also any wall/floor textures that uses the transparent color would be properly displayed as black in the map editor, while it would still be magenta in the tile browsing.
What we do now is to tweak the main translucency table if a Duke3D 1.5 or LameDuke translucency table is detected: for every i, 0 <= i <= 255, we set
transluc[255][i] = transluc[0][i]
transluc[0][i] = transluc[255][i]
This fixes the first issue you mention: a background color index 255 blended with a foreground color will yield a result as if the background had been color index 0.
What's left for vanilla Duke3D 1.5 is that in Mapster32, color index 255 is displayed as magenta for solid walls (in the game, the
base palettes are modified shortly after being loaded, setting index 255 to a black color for the default, water and slime base palettes). In Mapster32, the Lunatic 'engine' module functions like engine.setblendtab and engine.setshadetab allow registering the tables as many times as desired (for the game, we error if an already registered one is attemted to be set again). So, the tweaks you mention can be easily implemented in Lua code and the command running them added to m32_autoexec.cfg.
We don't modify the translucency table if the loaded one differs from the Duke3D 1.5 one because mods may be using row/column 255 for their own purposes. The
LNGA page for example states:
Quote
LNGA uses a table of color addition. The last row and column correspond to the transparent color (0xFF); they are dedicated to non-linear conversions.
Edit: so a solution would probably be allowing re-registering tables 0 in the game for the engine.* functions? Otherwise, there's no way to change palookup/blend 0 programmatically at startup.