mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 22:05:38 +00:00
Check for overflow. Fixes some fade effects
This commit is contained in:
parent
9a49fefe12
commit
ff8e9d6aad
|
@ -320,6 +320,10 @@ bool PolyHeader::AlphaTest()
|
||||||
|
|
||||||
UINT8 PolyHeader::Transparency()
|
UINT8 PolyHeader::Transparency()
|
||||||
{
|
{
|
||||||
|
if (header[6] & 0x800000) { // check top bit to see if its 1. Star wars is writing 1 for opaque, but the rest of the bits are garbage and are ignored
|
||||||
|
return 255; // without this check we get overflow. In the SDK, values are explicitly clamped to 0-32.
|
||||||
|
}
|
||||||
|
|
||||||
return (UINT8)((((header[6] >> 18) & 0x3F) * 255) / 32.f);
|
return (UINT8)((((header[6] >> 18) & 0x3F) * 255) / 32.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue