New engine: expanded color indices to 12 bits from 11. Added PolygonHeader::ColorIndex and SensorColorIndex methods.

This commit is contained in:
Bart Trzynadlowski 2016-05-28 20:49:10 +00:00
parent 2ef5203839
commit 5c1a240565
3 changed files with 13 additions and 1 deletions

View file

@ -958,7 +958,7 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
// copy face attributes
if ((ph.header[1] & 2) == 0) {
UINT32 colorIdx = (ph.header[4] >> 8) & 0x7FF;
int colorIdx = ph.ColorIndex();
p.faceColour[2] = (m_polyRAM[m_colorTableAddr + colorIdx] & 0xFF) / 255.f;
p.faceColour[1] = ((m_polyRAM[m_colorTableAddr + colorIdx] >> 8) & 0xFF) / 255.f;
p.faceColour[0] = ((m_polyRAM[m_colorTableAddr + colorIdx] >> 16) & 0xFF) / 255.f;

View file

@ -229,6 +229,16 @@ void PolyHeader::Color(UINT8& r, UINT8& g, UINT8& b)
b = (header[4] >> 8) & 0xFF;
}
int PolyHeader::ColorIndex()
{
return (header[4] >> 8) & 0xFFF;
}
int PolyHeader::SensorColorIndex()
{
return (header[4] >> 20) & 0xFFF;
}
bool PolyHeader::ColorDisabled()
{
return (header[4] & 0x80) > 0;

View file

@ -117,6 +117,8 @@ public:
//header 4
void Color(UINT8& r, UINT8& g, UINT8& b);
int ColorIndex();
int SensorColorIndex();
bool ColorDisabled();
int Page();