diff --git a/codemp/client/cl_main.cpp b/codemp/client/cl_main.cpp index bb8452773e..e419821775 100644 --- a/codemp/client/cl_main.cpp +++ b/codemp/client/cl_main.cpp @@ -106,6 +106,8 @@ cvar_t *cl_consoleUseScanCode; cvar_t *cl_lanForcePackets; +cvar_t *cl_coloredTextShadows; + cvar_t *cl_drawRecording; cvar_t *cl_colorString; @@ -3108,6 +3110,8 @@ void CL_Init( void ) { // cgame might not be initialized before menu is used Cvar_Get ("cg_viewsize", "100", CVAR_ARCHIVE_ND ); + cl_coloredTextShadows = Cvar_Get("cl_coloredTextShadows", "0", CVAR_ARCHIVE); + cl_afkTime = Cvar_Get("cl_afkTime", "5", CVAR_ARCHIVE, "Minutes to autorename to afk, 0 to disable"); cl_afkTimeUnfocused = Cvar_Get("cl_afkTimeUnfocused", "1", CVAR_ARCHIVE, "Minutes to autorename to afk while unfocused/minimized"); cl_unfocusedTime = 0; diff --git a/codemp/rd-common/tr_font.cpp b/codemp/rd-common/tr_font.cpp index 029ff208b6..78c62f33a8 100644 --- a/codemp/rd-common/tr_font.cpp +++ b/codemp/rd-common/tr_font.cpp @@ -1547,16 +1547,44 @@ void RE_Font_DrawString(int ox, int oy, const char *psText, const float *rgba, c } // Draw a dropshadow if required - if(iFontHandle & STYLE_DROPSHADOW) - { - offset = Round(curfont->GetPointSize() * fScale * 0.075f); + if (iFontHandle & STYLE_DROPSHADOW) + if (iFontHandle & STYLE_DROPSHADOW) + { + if (ri->Cvar_VariableIntegerValue("cl_coloredTextShadows")) { + int i = 0, r = 0; + char dropShadowText[1024]; + const vec4_t v4DKGREY2 = { 0.15f, 0.15f, 0.15f, rgba ? rgba[3] : 1.0f }; + + offset = Round(curfont->GetPointSize() * fScale * 0.075f); + + //^blah stuff confuses shadows, so parse it out first + while (psText[i] && r < 1024) { + if (psText[i] == '^') { + if ((i < 1 || psText[i - 1] != '^') && + (!psText[i + 1] || psText[i + 1] != '^')) { //If char before or after ^ is ^ then it prints ^ instead of accepting a colorcode + i += 2; + } + } - const vec4_t v4DKGREY2 = {0.15f, 0.15f, 0.15f, rgba?rgba[3]:1.0f}; + dropShadowText[r] = psText[i]; + r++; + i++; + } + dropShadowText[r] = 0; - gbInShadow = qtrue; - RE_Font_DrawString(ox + offset, oy + offset, psText, v4DKGREY2, iFontHandle & SET_MASK, iMaxPixelWidth, fScale); - gbInShadow = qfalse; - } + RE_Font_DrawString(ox + offset, oy + offset, dropShadowText, v4DKGREY2, iFontHandle & SET_MASK, iMaxPixelWidth, fScale); + } + else + { + const vec4_t v4DKGREY2 = { 0.15f, 0.15f, 0.15f, rgba ? rgba[3] : 1.0f }; + + offset = Round(curfont->GetPointSize() * fScale * 0.075f); + + gbInShadow = qtrue; + RE_Font_DrawString(ox + offset, oy + offset, psText, v4DKGREY2, iFontHandle & SET_MASK, iMaxPixelWidth, fScale); + gbInShadow = qfalse; + } + } RE_SetColor( rgba );