Merge pull request #17 from diamante0018/colordblind_team_colors
Colordblind team colors
This commit is contained in:
commit
e4ed04a3f7
@ -4,6 +4,9 @@ namespace Components
|
||||
{
|
||||
Dvar::Var Colors::NewColors;
|
||||
Dvar::Var Colors::ColorBlind;
|
||||
Dvar::Var Colors::ColorAlly;
|
||||
Dvar::Var Colors::ColorEnemy;
|
||||
|
||||
std::vector<DWORD> Colors::ColorTable;
|
||||
|
||||
DWORD Colors::HsvToRgb(Colors::HsvColor hsv)
|
||||
@ -228,17 +231,21 @@ namespace Components
|
||||
if (!str.compare("g_TeamColor_EnemyTeam"))
|
||||
{
|
||||
// A dark red
|
||||
color[0] = 0.659f;
|
||||
color[1] = 0.088f;
|
||||
color[2] = 0.145f;
|
||||
auto* colorlindEnemy = Colors::ColorEnemy.get<float*>();
|
||||
color[0] = colorlindEnemy[0];
|
||||
color[1] = colorlindEnemy[1];
|
||||
color[2] = colorlindEnemy[2];
|
||||
color[3] = colorlindEnemy[3];
|
||||
return false;
|
||||
}
|
||||
else if (!str.compare("g_TeamColor_MyTeam"))
|
||||
{
|
||||
// A bright yellow
|
||||
color[0] = 1.f;
|
||||
color[1] = 0.859f;
|
||||
color[2] = 0.125f;
|
||||
auto* colorblindAlly = Colors::ColorAlly.get<float*>();
|
||||
color[0] = colorblindAlly[0];
|
||||
color[1] = colorblindAlly[1];
|
||||
color[2] = colorblindAlly[2];
|
||||
color[3] = colorblindAlly[3];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -272,6 +279,8 @@ namespace Components
|
||||
{
|
||||
// Add a colorblind mode for team colors
|
||||
Colors::ColorBlind = Dvar::Register<bool>("r_colorBlindTeams", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Use color-blindness-friendly colors for ingame team names");
|
||||
Colors::ColorEnemy = Game::Dvar_RegisterVec4("g_TeamColor_EnemyTeam_Color", 0.659f, 0.088f, 0.145f, 1, 0, 1, Game::dvar_flag::DVAR_FLAG_SAVED, "Enemy team color");
|
||||
Colors::ColorAlly = Game::Dvar_RegisterVec4("g_TeamColor_MyTeam_Color", 1, 0.859f, 0.125f, 1, 0, 1, Game::dvar_flag::DVAR_FLAG_SAVED, "Allied team color");
|
||||
Utils::Hook(0x406530, Colors::GetUnpackedColorByNameStub, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Disable SV_UpdateUserinfo_f, to block changing the name ingame
|
||||
|
@ -23,6 +23,8 @@ namespace Components
|
||||
|
||||
static Dvar::Var NewColors;
|
||||
static Dvar::Var ColorBlind;
|
||||
static Dvar::Var ColorAlly;
|
||||
static Dvar::Var ColorEnemy;
|
||||
|
||||
static DWORD HsvToRgb(HsvColor hsv);
|
||||
|
||||
|
@ -99,11 +99,11 @@ namespace Game
|
||||
Dvar_RegisterFloat_t Dvar_RegisterFloat = Dvar_RegisterFloat_t(0x648440);
|
||||
Dvar_RegisterVec2_t Dvar_RegisterVec2 = Dvar_RegisterVec2_t(0x4F6070);
|
||||
Dvar_RegisterVec3_t Dvar_RegisterVec3 = Dvar_RegisterVec3_t(0x4EF8E0);
|
||||
Dvar_RegisterVec4_t Dvar_RegisterVec4 = Dvar_RegisterVec4_t(0x4F28E0);
|
||||
Dvar_RegisterVec4_t Dvar_RegisterVec4 = Dvar_RegisterVec4_t(0x471500);
|
||||
Dvar_RegisterInt_t Dvar_RegisterInt = Dvar_RegisterInt_t(0x479830);
|
||||
Dvar_RegisterEnum_t Dvar_RegisterEnum = Dvar_RegisterEnum_t(0x412E40);
|
||||
Dvar_RegisterString_t Dvar_RegisterString = Dvar_RegisterString_t(0x4FC7E0);
|
||||
Dvar_RegisterColor_t Dvar_RegisterColor = Dvar_RegisterColor_t(0x4F28E0);//0x471500;
|
||||
Dvar_RegisterColor_t Dvar_RegisterColor = Dvar_RegisterColor_t(0x4F28E0);
|
||||
|
||||
Dvar_GetUnpackedColorByName_t Dvar_GetUnpackedColorByName = Dvar_GetUnpackedColorByName_t(0x406530);
|
||||
Dvar_FindVar_t Dvar_FindVar = Dvar_FindVar_t(0x4D5390);
|
||||
|
Loading…
Reference in New Issue
Block a user