mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Refactor CSkins7::GetColor
function
Use existing color constructor to conditionally unpack the alpha component instead of doing this separately. Make `DARKEST_COLOR_LGT` a `float` constant instead of using an `enum` to simplify the usage.
This commit is contained in:
parent
abf8fac568
commit
ce0e52851c
|
@ -476,11 +476,7 @@ void CSkins7::RandomizeSkin(int Dummy)
|
|||
|
||||
ColorRGBA CSkins7::GetColor(int Value, bool UseAlpha) const
|
||||
{
|
||||
float Dark = DARKEST_COLOR_LGT / 255.0f;
|
||||
ColorRGBA Color = color_cast<ColorRGBA>(ColorHSLA(Value).UnclampLighting(Dark));
|
||||
float Alpha = UseAlpha ? ((Value >> 24) & 0xff) / 255.0f : 1.0f;
|
||||
Color.a = Alpha;
|
||||
return Color;
|
||||
return color_cast<ColorRGBA>(ColorHSLA(Value, UseAlpha).UnclampLighting(DARKEST_COLOR_LGT));
|
||||
}
|
||||
|
||||
ColorRGBA CSkins7::GetTeamColor(int UseCustomColors, int PartColor, int Team, int Part) const
|
||||
|
|
|
@ -20,14 +20,14 @@ public:
|
|||
SKINFLAG_SPECIAL = 1 << 0,
|
||||
SKINFLAG_STANDARD = 1 << 1,
|
||||
|
||||
DARKEST_COLOR_LGT = 61,
|
||||
|
||||
NUM_COLOR_COMPONENTS = 4,
|
||||
|
||||
HAT_NUM = 2,
|
||||
HAT_OFFSET_SIDE = 2,
|
||||
};
|
||||
|
||||
static constexpr float DARKEST_COLOR_LGT = 61.0f / 255.0f;
|
||||
|
||||
struct CSkinPart
|
||||
{
|
||||
int m_Flags;
|
||||
|
|
Loading…
Reference in a new issue