diff --git a/codemp/client/cl_console.cpp b/codemp/client/cl_console.cpp index 4534bfa68c..88e5f6cde2 100644 --- a/codemp/client/cl_console.cpp +++ b/codemp/client/cl_console.cpp @@ -38,6 +38,7 @@ cvar_t *con_conspeed; cvar_t *con_notifytime; cvar_t *con_opacity; // background alpha multiplier cvar_t *con_autoclear; +cvar_t *con_notifyname; #define DEFAULT_CONSOLE_WIDTH 78 @@ -507,6 +508,7 @@ void Con_Init (void) { con_opacity = Cvar_Get ("con_opacity", "1.0", CVAR_ARCHIVE, "Opacity of console background"); con_autoclear = Cvar_Get ("con_autoclear", "1", CVAR_ARCHIVE, "Automatically clear console input on close"); + con_notifyname = Cvar_Get("con_notifyname", "0", CVAR_ARCHIVE, "Notifies you when name is mentioned"); Field_Clear( &g_consoleField ); g_consoleField.widthInChars = g_console_field_width; @@ -551,6 +553,7 @@ Con_Linefeed static void Con_Linefeed (qboolean skipnotify) { int i; + char design[] = "::::::::"; // mark time for transparent overlay if (con.current >= 0) @@ -561,11 +564,14 @@ static void Con_Linefeed (qboolean skipnotify) con.times[con.current % NUM_CON_TIMES] = cls.realtime; } - con.x = 0; + con.x = 9; if (con.display == con.current) con.display++; con.current++; - for(i=0; istring != "0" && Q_stristr(Q_strrchr(txtc, ':'), con_notifyname->string)) { + stampColor = COLOR_CYAN; + #ifdef _WIN32 + con_alert = qtrue; + #endif + } + else stampColor = COLOR_WHITE; } + else if (txt[0] == ']') stampColor = COLOR_GREEN; + else stampColor = COLOR_GREY; + stampColor -= '0'; // for some demos we don't want to ever show anything on the console if ( cl_noprint && cl_noprint->integer ) { return; } + Com_RealTime(&now); + if (lastTime.tm_hour != now.tm_hour || lastTime.tm_min != now.tm_min || lastTime.tm_sec != now.tm_sec) { + lastTime.tm_hour = now.tm_hour, lastTime.tm_min = now.tm_min, lastTime.tm_sec = now.tm_sec; + Com_sprintf(txtt, sizeof(txtt), "^%i%02d:%02d:%02d ^7%s", stampColor, now.tm_hour, now.tm_min, now.tm_sec, txt); + txt = va("%s", txtt); + } + else { + txt = va("^%i%s ^7%s", stampColor, "::::::::", txt); + } + if (!con.initialized) { con.color[0] = con.color[1] = @@ -644,7 +666,6 @@ void CL_ConsolePrint( const char *txt) { // word wrap if (l != con.linewidth && (con.x + l >= con.linewidth) ) { Con_Linefeed(skipnotify); - } txt++; @@ -655,7 +676,7 @@ void CL_ConsolePrint( const char *txt) { Con_Linefeed (skipnotify); break; case '\r': - con.x = 0; + con.x = 9; break; default: // display character and advance y = con.current % con.totallines; @@ -668,6 +689,7 @@ void CL_ConsolePrint( const char *txt) { } } + con.x = 0; // mark time for transparent overlay diff --git a/codemp/client/client.h b/codemp/client/client.h index da4e1c58e2..5f82dab93a 100644 --- a/codemp/client/client.h +++ b/codemp/client/client.h @@ -540,6 +540,9 @@ void Con_SetFrac(const float conFrac); void Con_Copy(void); void Con_CopyLink(void); +#ifdef _WIN32 +extern qboolean con_alert; +#endif // // cl_scrn.c diff --git a/codemp/rd-vanilla/tr_init.cpp b/codemp/rd-vanilla/tr_init.cpp index 66509cad0d..7cda003e2b 100644 --- a/codemp/rd-vanilla/tr_init.cpp +++ b/codemp/rd-vanilla/tr_init.cpp @@ -1350,16 +1350,20 @@ Workaround for ri->Printf's 1024 characters buffer limit. */ void R_PrintLongString(const char *string) { char buffer[1024]; - const char *p; + const char *p, *s; int size = strlen(string); + int bufferSize; p = string; while(size > 0) { - Q_strncpyz(buffer, p, sizeof (buffer) ); + s = p + 1023; + while (*s > ' ') s--; + bufferSize = s - p; + Q_strncpyz(buffer, p, bufferSize); ri->Printf( PRINT_ALL, "%s", buffer ); - p += 1023; - size -= 1023; + p = s + 1; + size -= bufferSize; } } diff --git a/shared/sdl/sdl_input.cpp b/shared/sdl/sdl_input.cpp index c7f873187e..129da29c60 100644 --- a/shared/sdl/sdl_input.cpp +++ b/shared/sdl/sdl_input.cpp @@ -781,6 +781,12 @@ static void IN_ProcessEvents( void ) if( !SDL_WasInit( SDL_INIT_VIDEO ) ) return; + #ifdef _WIN32 + if (com_unfocused->integer == 1 && con_alert == qtrue) { + GLimp_Alert(); + con_alert = qfalse; + } + #endif while( SDL_PollEvent( &e ) ) { @@ -888,6 +894,9 @@ static void IN_ProcessEvents( void ) Cvar_SetValue( "com_unfocused", 1 ); SNDDMA_Activate( qfalse ); cl_unfocusedTime = cls.realtime; + #ifdef _WIN32 + con_alert = qfalse; + #endif break; } diff --git a/shared/sdl/sdl_window.cpp b/shared/sdl/sdl_window.cpp index f784c338e7..10f6a0b236 100644 --- a/shared/sdl/sdl_window.cpp +++ b/shared/sdl/sdl_window.cpp @@ -142,6 +142,14 @@ void GLimp_Minimize(void) SDL_MinimizeWindow( screen ); } +#ifdef _WIN32 +qboolean con_alert; +static FLASHWINFO fi; +void GLimp_Alert(void) { + FlashWindowEx(&fi); +} +#endif + void WIN_Present( window_t *window ) { if ( window->api == GRAPHICS_API_OPENGL ) @@ -778,15 +786,23 @@ window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig ) window.api = windowDesc->api; -#if defined(_WIN32) +#ifdef _WIN32 SDL_SysWMinfo info; SDL_VERSION(&info.version); + con_alert = qfalse; + if ( SDL_GetWindowWMInfo(screen, &info) ) { switch(info.subsystem) { case SDL_SYSWM_WINDOWS: window.handle = info.info.win.window; + + fi.cbSize = sizeof(FLASHWINFO); + fi.hwnd = info.info.win.window; + fi.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; + fi.uCount = 0; + fi.dwTimeout = 0; break; default: diff --git a/shared/sys/sys_local.h b/shared/sys/sys_local.h index 815adc5eff..7a1804a219 100644 --- a/shared/sys/sys_local.h +++ b/shared/sys/sys_local.h @@ -34,6 +34,9 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ); char *Sys_ConsoleInput( void ); void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr ); void Sys_SigHandler( int signal ); +#ifdef _WIN32 +extern void GLimp_Alert(void); +#endif #ifndef _WIN32 void Sys_AnsiColorPrint( const char *msg ); #endif