Engine: Compiling with the included Visual Studio project uses signed char, but unsigned char is required
If the binary is compiled using the included Visual Studio project, it compiles char
as a signed 8 bit integer. However, the assumption made in the code is that char
is unsigned. This probably affects the entire codebase, but in particular, the caching system is broken by this issue:
enum cachelock_t : char
{
CACHE1D_FREE = 1,
CACHE1D_UNLOCKED = 199,
CACHE1D_LOCKED = 200,
CACHE1D_PERMANENT = 255,
};
Because the enum values are all greater than 127, all values except CACHE1D_FREE
will be negative if compiled with VS.
One observable effect is that per-map art will never load:
// Tiles having dummytile replacements or those that are
// cache1d-locked can't be replaced.
if (faketile[i>>3] & pow2char[i&7] || walock[i] >= CACHE1D_LOCKED)
{
initprintf("loadpics: per-map ART file \"%s\": "
"tile %d has dummytile or is locked\n", fn, i);
kclose(fil);
return -3;
}
Since walock[i] is initialized to 0, this conditional will likely return true, preventing the mapart from replacing the tile.