diff --git a/src/Components/Modules/Colors.cpp b/src/Components/Modules/Colors.cpp index 52ad1f77..15407879 100644 --- a/src/Components/Modules/Colors.cpp +++ b/src/Components/Modules/Colors.cpp @@ -4,6 +4,9 @@ namespace Components { Dvar::Var Colors::NewColors; Dvar::Var Colors::ColorBlind; + Dvar::Var Colors::ColorAlly; + Dvar::Var Colors::ColorEnemy; + std::vector 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(); + 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(); + 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("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 diff --git a/src/Components/Modules/Colors.hpp b/src/Components/Modules/Colors.hpp index 9729dc2f..a964c674 100644 --- a/src/Components/Modules/Colors.hpp +++ b/src/Components/Modules/Colors.hpp @@ -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); diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index cb4a819f..0ed7b3cc 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -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);