diff --git a/code/client/cl_main.cpp b/code/client/cl_main.cpp index be0b453..06896fa 100644 --- a/code/client/cl_main.cpp +++ b/code/client/cl_main.cpp @@ -2440,11 +2440,11 @@ static const cvarTableItemCPMA_t cpma_cvars[] = "Crosshair text", CVARCAT_HUD, "Crosshair uses this text instead of an icon", "" }, { - "ch_crosshairHitColor", CVART_COLOR_CPMA, + "ch_crosshairHitColor", CVART_COLOR_CPMA_E, "Crosshair hit color", CVARCAT_HUD, "", "" }, { - "ch_crosshairFragColor", CVART_COLOR_CPMA, + "ch_crosshairFragColor", CVART_COLOR_CPMA_E, "Crosshair kill color", CVARCAT_HUD, "", "" }, { diff --git a/code/qcommon/cvar.cpp b/code/qcommon/cvar.cpp index bd3a116..1b65f83 100644 --- a/code/qcommon/cvar.cpp +++ b/code/qcommon/cvar.cpp @@ -247,6 +247,9 @@ static qbool Cvar_IsValidValue( cvar_t *var, const char *value, qboolean printWa WARNING( "must be a single char" ); if ( !IsCPMAColorCode(value[0]) ) WARNING( "invalid color code, must be [a-zA-Z0-9]" ); + } else if ( var->type == CVART_COLOR_CPMA_E ) { + if ( value[0] != '\0' && !IsCPMAColorCode(value[0]) ) + WARNING( "invalid color code, must be [a-zA-Z0-9] or empty" ); } else if ( var->type == CVART_COLOR_CHBLS ) { if ( strlen(value) != 5 ) WARNING( "must be 5 chars" ); @@ -640,6 +643,7 @@ void Cvar_SetDataType( const char* cvarName, cvarType_t type ) Q_assert( type == CVART_STRING || type == CVART_COLOR_CPMA || + type == CVART_COLOR_CPMA_E || type == CVART_COLOR_CHBLS || type == CVART_COLOR_RGB || type == CVART_COLOR_RGBA ); @@ -826,10 +830,10 @@ void Cvar_PrintTypeAndRange( const char *var_name, printf_t print ) print( "RGB" ); } else if ( var->type == CVART_COLOR_RGBA ) { print( "RGBA" ); - } else if ( var->type == CVART_COLOR_CPMA ) { - print( "color_code" ); + } else if ( var->type == CVART_COLOR_CPMA || var->type == CVART_COLOR_CPMA_E ) { + print( "color code" ); } else if ( var->type == CVART_COLOR_CHBLS ) { - print( "color_CHBLS" ); + print( "CHBLS colors" ); } else { print( "string" ); } diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 62932c4..946f39f 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -698,6 +698,7 @@ typedef enum { CVART_BOOL, // uses integer min/max bounds, min=0 and max=1 // extended data types (not currently used by the CPMA QVMs) CVART_COLOR_CPMA, // CPMA color code (0-9 A-Z a-z) + CVART_COLOR_CPMA_E, // CPMA color code or empty CVART_COLOR_CHBLS, // CPMA color codes: rail Core, Head, Body, Legs, rail Spiral CVART_COLOR_RGB, // as hex, e.g. FF00FF CVART_COLOR_RGBA, // as hex, e.g. FF00FF00