now showing the cvar's current value in the help panel

This commit is contained in:
myT 2019-02-21 17:15:55 +01:00
parent c75caeb98e
commit b089166978
2 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,8 @@
DD Mmm 19 - 1.51
add: now showing the cvar's current and latched values in the help panel
add: new console and chat keyboard shortcuts
Ctrl-left/right arrow | move caret to previous/next word
Shift-left/right arrow | move caret to previous/next argument

View File

@ -3480,6 +3480,25 @@ printHelpResult_t Com_PrintHelp( const char* name, printf_t print, qbool printNo
else
print( S_COLOR_CMD "%s\n", name );
const cvar_t* const cvar = Cvar_FindVar( name );
if ( cvar != NULL ) {
const char* const quote1 = cvar->type == CVART_STRING ? "\"" : "";
const char* const quote2 = cvar->type == CVART_STRING ? "^7\"" : "^7";
if ( cvar->latchedString != NULL ) {
const char* const combined =
va( "Current: %s" S_COLOR_VAL "%s%s (Latched: %s" S_COLOR_VAL "%s%s)\n",
quote1, cvar->string, quote2, quote1, cvar->latchedString, quote2 );
if ( strlen( combined ) < CONSOLE_WIDTH ) {
print( combined );
} else {
print( "Current: %s" S_COLOR_VAL "%s%s\n", quote1, cvar->string, quote2 );
print( "Latched: %s" S_COLOR_VAL "%s%s\n", quote1, cvar->latchedString, quote2 );
}
} else {
print( "Current: %s" S_COLOR_VAL "%s" S_COLOR_HELP "%s\n", quote1, cvar->string, quote2 );
}
}
if ( printModules )
Com_PrintModules( firstModule, moduleMask, print );