When the translator map is enabled the colour values seem to use 4 bits, 0-16. Why not 0-31 I don't know. Anyway virtua on is overflowing these values for some of the smoke effects. For us the numbers were wrapping around. Clamping is enough to fix this. (Thanks model123)

This commit is contained in:
Ian Curtis 2020-05-07 19:34:22 +00:00
parent 5b406059ce
commit e2ad593e88

View file

@ -1141,9 +1141,9 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
p.faceColour[2] = ((ph.header[4] >> 8) & 0xFF);
if (ph.TranslatorMap()) {
p.faceColour[0] = (p.faceColour[0] * 255) / 16; // When the translator map is enabled, max colour seems
p.faceColour[1] = (p.faceColour[1] * 255) / 16; // to be 16. Scaling these up gives the correct colours.
p.faceColour[2] = (p.faceColour[2] * 255) / 16; // Not sure why didn't allow 32 colours with 4 bits?
p.faceColour[0] = std::min((p.faceColour[0] * 255) / 16, 255); // When the translator map is enabled, max colour seems to be 16. Why not 4 bits?
p.faceColour[1] = std::min((p.faceColour[1] * 255) / 16, 255); // We clamp the result because virtua on will overflow for only the smoke effects
p.faceColour[2] = std::min((p.faceColour[2] * 255) / 16, 255); // It's passing 33 instead of a max of 16.
}
}