Browse Source

engine: client: fix taking console color from colors.lst

master
Alibek Omarov 5 months ago
parent
commit
47bc50b8c6
  1. 7
      engine/client/cl_gameui.c
  2. 2
      engine/client/client.h
  3. 15
      engine/client/console.c

7
engine/client/cl_gameui.c

@ -1092,6 +1092,11 @@ static int pfnDelete( const char *path ) @@ -1092,6 +1092,11 @@ static int pfnDelete( const char *path )
return FS_Delete( path );
}
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
{
Con_DefaultColor( r, g, b, true );
}
// engine callbacks
static ui_enginefuncs_t gEngfuncs =
{
@ -1131,7 +1136,7 @@ static ui_enginefuncs_t gEngfuncs = @@ -1131,7 +1136,7 @@ static ui_enginefuncs_t gEngfuncs =
UI_DrawConsoleString,
UI_DrawSetTextColor,
Con_DrawStringLen,
Con_DefaultColor,
pfnCon_DefaultColor,
pfnGetPlayerModel,
pfnSetPlayerModel,
pfnClearScene,

2
engine/client/client.h

@ -1072,7 +1072,7 @@ int Con_UtfProcessChar( int in ); @@ -1072,7 +1072,7 @@ int Con_UtfProcessChar( int in );
int Con_UtfProcessCharForce( int in );
int Con_UtfMoveLeft( char *str, int pos );
int Con_UtfMoveRight( char *str, int pos, int length );
void Con_DefaultColor( int r, int g, int b );
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
void Con_InvalidateFonts( void );
cl_font_t *Con_GetCurFont( void );
cl_font_t *Con_GetFont( int num );

15
engine/client/console.c

@ -175,10 +175,10 @@ static void Con_SetColor( void ) @@ -175,10 +175,10 @@ static void Con_SetColor( void )
switch( num )
{
case 1:
Con_DefaultColor( r, r, r );
Con_DefaultColor( r, r, r, false );
break;
case 3:
Con_DefaultColor( r, g, b );
Con_DefaultColor( r, g, b, false );
break;
default:
Cvar_DirectSet( &con_color, con_color.def_string );
@ -2310,11 +2310,20 @@ Con_DefaultColor @@ -2310,11 +2310,20 @@ Con_DefaultColor
called from MainUI
=========
*/
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
void Con_DefaultColor( int r, int g, int b, qboolean gameui )
{
r = bound( 0, r, 255 );
g = bound( 0, g, 255 );
b = bound( 0, b, 255 );
// gameui wants to override console color... check if it's not default
if( gameui && ( g_color_table[7][0] != r || g_color_table[7][1] != g || g_color_table[7][2] != b ))
{
// yes, different from default orange, disable con_color
SetBits( con_color.flags, FCVAR_READ_ONLY );
ClearBits( con_color.flags, FCVAR_CHANGED );
}
MakeRGBA( g_color_table[7], r, g, b, 255 );
}

Loading…
Cancel
Save