This code can be reused (and gets reused very fine)

This commit is contained in:
Silent 2017-12-30 12:45:12 +01:00
parent 88664b2279
commit b22bed5802

View file

@ -664,25 +664,21 @@ void DrawMoonWithPhases(uint8_t moonColor, float* screenPos, float sizeX, float
//D3DPERF_EndEvent(); //D3DPERF_EndEvent();
} }
CRGBA* CRGBA::BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 );
*this = CRGBA(BlendSqr( HudColour[3], CRGBA(r, g, b), colourIntensity ), a);
return this;
}
static bool bColouredZoneNames; static bool bColouredZoneNames;
CRGBA* CRGBA::BlendGangColour_Dynamic(uint8_t r, uint8_t g, uint8_t b, uint8_t a) CRGBA* CRGBA::BlendGangColour_Dynamic(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{ {
if ( bColouredZoneNames ) if ( bColouredZoneNames )
{ {
const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 ); return BlendGangColour(r, g, b, a);
*this = CRGBA(BlendSqr( HudColour[3], CRGBA(r, g, b), colourIntensity ), a);
} }
else *this = HudColour[3];
{
*this = HudColour[3];
}
return this;
}
CRGBA* CRGBA::BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 );
*this = CRGBA(BlendSqr( HudColour[3], CRGBA(r, g, b), colourIntensity ), a);
return this; return this;
} }