Add a flag for colors with alpha

This commit is contained in:
Learath 2019-05-01 13:58:51 +03:00
parent 324c389e87
commit f479f69735
3 changed files with 6 additions and 4 deletions

View file

@ -37,6 +37,7 @@ enum
CFGFLAG_GAME=1<<8, CFGFLAG_GAME=1<<8,
CFGFLAG_NONTEEHISTORIC=1<<9, CFGFLAG_NONTEEHISTORIC=1<<9,
CFGFLAG_COLLIGHT=1<<10, CFGFLAG_COLLIGHT=1<<10,
CFGFLAG_COLALPHA=1<<11,
}; };
#endif #endif

View file

@ -708,8 +708,9 @@ struct CIntVariableData
struct CColVariableData : public CIntVariableData struct CColVariableData : public CIntVariableData
{ {
template<class... T> CColVariableData(bool b, T... t) : CIntVariableData{t...}, m_Light(b) {} template<class... T> CColVariableData(bool l, bool a, T... t) : CIntVariableData{t...}, m_Light(l), m_Alpha(a) {}
bool m_Light; bool m_Light;
bool m_Alpha;
}; };
struct CStrVariableData struct CStrVariableData
@ -755,7 +756,7 @@ static void ColVariableCommand(IConsole::IResult *pResult, void *pUserData)
if(pResult->NumArguments()) if(pResult->NumArguments())
{ {
int Val = pResult->GetColor(0, pData->m_Light).Pack() & (pData->m_Light ? 0xFFFFFF : 0xFFFFFFFF); int Val = pResult->GetColor(0, pData->m_Light).Pack() & (pData->m_Alpha ? 0xFFFFFFFF : 0xFFFFFF);
*(pData->m_pVariable) = Val; *(pData->m_pVariable) = Val;
if(pResult->m_ClientID != IConsole::CLIENT_ID_GAME) if(pResult->m_ClientID != IConsole::CLIENT_ID_GAME)
@ -936,7 +937,7 @@ CConsole::CConsole(int FlagMask)
#define MACRO_CONFIG_COL(Name,ScriptName,Def,Min,Max,Flags,Desc) \ #define MACRO_CONFIG_COL(Name,ScriptName,Def,Min,Max,Flags,Desc) \
{ \ { \
static CColVariableData Data = { static_cast<bool>((Flags) & CFGFLAG_COLLIGHT), this, &g_Config.m_##Name, Min, Max, Def }; \ static CColVariableData Data = { static_cast<bool>((Flags) & CFGFLAG_COLLIGHT), static_cast<bool>((Flags) & CFGFLAG_COLALPHA), this, &g_Config.m_##Name, Min, Max, Def }; \
Register(#ScriptName, "?i", Flags, ColVariableCommand, &Data, Desc); \ Register(#ScriptName, "?i", Flags, ColVariableCommand, &Data, Desc); \
} }

View file

@ -89,7 +89,7 @@ MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFL
MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale") MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale")
MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 1, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 1, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor")
MACRO_CONFIG_COL(UiColor, ui_color, (int)0xE4A046AF, 0, (int)0xFFFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color") // 160 70 175 228 hasalpha MACRO_CONFIG_COL(UiColor, ui_color, (int)0xE4A046AF, 0, (int)0xFFFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE|CFGFLAG_COLALPHA, "Interface color") // 160 70 175 228 hasalpha
MACRO_CONFIG_INT(UiColorizePing, ui_colorize_ping, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Highlight ping") MACRO_CONFIG_INT(UiColorizePing, ui_colorize_ping, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Highlight ping")
MACRO_CONFIG_INT(UiColorizeGametype, ui_colorize_gametype, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Highlight gametype") MACRO_CONFIG_INT(UiColorizeGametype, ui_colorize_gametype, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Highlight gametype")