diff --git a/src/Components/Modules/Colors.cpp b/src/Components/Modules/Colors.cpp index c3f01f9f..8cd7fb08 100644 --- a/src/Components/Modules/Colors.cpp +++ b/src/Components/Modules/Colors.cpp @@ -147,6 +147,8 @@ namespace Components void Colors::LookupColor(DWORD* color, char index) { + *color = RGB(255, 255, 255); + if (index == '8') // Color 8 { *color = *reinterpret_cast(0x66E5F70); @@ -159,6 +161,12 @@ namespace Components { *color = Colors::HsvToRgb({ static_cast((Game::Com_Milliseconds() / 200) % 256), 255,255 }); } + else if (index == ';') + { + float fltColor[4]; + Game::Dvar_GetUnpackedColorByName("sv_color_value", fltColor); + *color = RGB(fltColor[0] * 255, fltColor[1] * 255, fltColor[2] * 255); + } else { int clrIndex = Colors::ColorIndex(index); @@ -214,6 +222,7 @@ namespace Components // Register dvar Colors::NewColors = Dvar::Register("cg_newColors", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Use WarfareČ color code style."); + Game::Dvar_RegisterColor("sv_color_value", 1, 0.7f, 0, 1, Game::dvar_flag::DVAR_FLAG_REPLICATED, "Color for the extended color code."); // Add our colors Colors::Add(0, 0, 0); // 0 - Black @@ -230,8 +239,8 @@ namespace Components Colors::Add(0, 0, 0); // 9 - Team color (allies?) // Custom colors - Colors::Add(0, 0, 0); // 10 - Rainbow (:) - //Colors::Add(0, 255, 200); // 11 - Turqoise (;) - using that color in infostrings (e.g. your name) fails, ';' is an illegal character! + Colors::Add(0, 0, 0); // 10 - Rainbow (:) + Colors::Add(0, 0, 0); // 11 - Server color (;) - using that color in infostrings (e.g. your name) fails, ';' is an illegal character! } Colors::~Colors() diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index babadbbc..11e14107 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -35,8 +35,9 @@ namespace Game 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)0x471500; + Dvar_RegisterColor_t Dvar_RegisterColor = (Dvar_RegisterColor_t)0x4F28E0;//0x471500; + Dvar_GetUnpackedColorByName_t Dvar_GetUnpackedColorByName = (Dvar_GetUnpackedColorByName_t)0x406530; Dvar_FindVar_t Dvar_FindVar = (Dvar_FindVar_t)0x4D5390; Dvar_InfoString_Big_t Dvar_InfoString_Big = (Dvar_InfoString_Big_t)0x4D98A0; Dvar_SetCommand_t Dvar_SetCommand = (Dvar_SetCommand_t)0x4EE430; diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 4cf0667a..2659036e 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -81,6 +81,9 @@ namespace Game typedef dvar_t* (__cdecl * Dvar_RegisterColor_t)(const char* name, float r, float g, float b, float a, int flags, const char* description); extern Dvar_RegisterColor_t Dvar_RegisterColor; + typedef void(__cdecl * Dvar_GetUnpackedColorByName_t)(const char* name, float* color); + extern Dvar_GetUnpackedColorByName_t Dvar_GetUnpackedColorByName; + typedef dvar_t* (__cdecl * Dvar_FindVar_t)(const char *dvarName); extern Dvar_FindVar_t Dvar_FindVar;