@@ -71,6 +71,7 @@ cvar_t *con_backColor;
7171
7272cvar_t * con_scrollBar ;
7373cvar_t * con_scrollLines ;
74+ cvar_t * con_drawClock ;
7475
7576int g_console_field_width = DEFAULT_CONSOLE_WIDTH ;
7677
@@ -417,19 +418,21 @@ Con_Init
417418================
418419*/
419420void Con_Init ( void ) {
420- con_notifyTime = Cvar_Get ( "con_notifyTime" , "3" , 0 , "0" , "10" , CV_FLOAT );
421+ con_notifyTime = Cvar_Get ( "con_notifyTime" , "3" , CVAR_ARCHIVE_ND , "0" , "10" , CV_FLOAT );
421422 /**/ Cvar_SetDescription ( con_notifyTime , "Time notifications are displayed for (in seconds.)" );
422- con_speed = Cvar_Get ( "con_speed" , "3" , 0 , "1" , "10" , CV_FLOAT );
423+ con_speed = Cvar_Get ( "con_speed" , "3" , CVAR_ARCHIVE_ND , "1" , "10" , CV_FLOAT );
423424 /**/ Cvar_SetDescription ( con_speed , "Console opening/closing scroll speed." );
424425
425- con_notifyXOffset = Cvar_Get ( "con_notifyXOffset" , "0" , 0 , "0" , NULL , CV_INTEGER );
426+ con_notifyXOffset = Cvar_Get ( "con_notifyXOffset" , "0" , CVAR_ARCHIVE_ND , "0" , NULL , CV_INTEGER );
426427 /**/ Cvar_SetDescription ( con_notifyXOffset , "Notifications X-offset." );
427- con_backColor = Cvar_Get ( "con_backColor" , "" , 0 , NULL , NULL , CV_NONE );
428+ con_backColor = Cvar_Get ( "con_backColor" , "" , CVAR_ARCHIVE_ND , NULL , NULL , CV_NONE );
428429 /**/ Cvar_SetDescription ( con_backColor , "Console background color, set as R G B values from 0-255." );
429- con_scrollBar = Cvar_Get ( "con_scrollBar" , "1" , 0 , "0" , "1" , CV_INTEGER );
430+ con_scrollBar = Cvar_Get ( "con_scrollBar" , "1" , CVAR_ARCHIVE_ND , "0" , "1" , CV_INTEGER );
430431 /**/ Cvar_SetDescription ( con_scrollBar , "Draws the console scroll bar." );
431- con_scrollLines = Cvar_Get ( "con_scrollLines" , "2" , 0 , "1" , "8" , CV_INTEGER );
432+ con_scrollLines = Cvar_Get ( "con_scrollLines" , "2" , CVAR_ARCHIVE_ND , "1" , "8" , CV_INTEGER );
432433 /**/ Cvar_SetDescription ( con_scrollLines , "Console line scroll factor." );
434+ con_drawClock = Cvar_Get ( "con_drawClock" , "0" , CVAR_ARCHIVE_ND , "0" , "2" , CV_INTEGER );
435+ /**/ Cvar_SetDescription ( con_drawClock , "Draws current time in console.\n 0: Hidden\n 1: 24 hour clock\n 2: AM/PM clock" );
433436
434437 Field_Clear ( & g_consoleField );
435438 g_consoleField .widthInChars = g_console_field_width ;
@@ -833,9 +836,27 @@ void Con_DrawSolidConsole( float frac, const int scrAdjust ) {
833836 //y = yf;
834837
835838 // draw the version number
836- SCR_DrawSmallString ( cls .glconfig .vidWidth - ( ARRAY_LEN ( PRODUCT_VERSION ) ) * cls .smallchar_width ,
839+ SCR_DrawSmallString ( cls .glconfig .vidWidth - ( ARRAY_LEN ( PRODUCT_VERSION ) + 1 ) * cls .smallchar_width ,
837840 lines - cls .smallchar_height , PRODUCT_VERSION , ARRAY_LEN ( PRODUCT_VERSION ) - 1 , SA_NONE );
838841
842+ // draw time
843+ if ( con_drawClock -> integer ) {
844+ qtime_t t ;
845+ const char * ts ;
846+ int tl ;
847+
848+ Com_RealTime ( & t );
849+
850+ if ( con_drawClock -> integer > 1 ) {
851+ ts = va ( "%d:%02d:%02d %s" , t .tm_hour % 12 , t .tm_min , t .tm_sec , ( t .tm_hour >= 12 ) ? "PM" : "AM" );
852+ } else {
853+ ts = va ( "%d:%02d:%02d" , t .tm_hour , t .tm_min , t .tm_sec );
854+ }
855+ tl = strlen ( ts );
856+ SCR_DrawSmallString ( cls .glconfig .vidWidth - (tl + 2 ) * cls .smallchar_width ,
857+ lines - cls .smallchar_height * 2 , ts , tl , SA_NONE );
858+ }
859+
839860 // draw the text
840861 con .visLines = lines ;
841862 rows = lines / cls .smallchar_height - 1 ; // rows of text to draw
0 commit comments