/* ================== SCR_SetUpToDrawConsole ================== */ void SCR_SetUpToDrawConsole (void) { Con_CheckResize (); if (scr_drawloading) return; // never a console with loading plaque // decide on the height of the console con_forcedup = !cl.worldmodel || cls.signon != SIGNONS; if (con_forcedup) { scr_conlines = vid.height; // full screen scr_con_current = scr_conlines; } else if (key_dest == key_console) // 2000-01-12 Variable console height by Fett/Maddes start { // scr_conlines = vid.height/2; // half screen scr_conlines = vid.height*scr_conheight->value; // in-game console if (scr_conlines < (3*8+8+8)) // always leave three lines visible (plus command line and border) { scr_conlines = (3*8+8+8); } if (scr_conlines >= vid.height) { scr_conlines = vid.height - 1; // maximum is full screen } } // 2000-01-12 Variable console height by Fett/Maddes end else scr_conlines = 0; // none visible if (scr_conlines < scr_con_current) { // 2001-10-20 TIMESCALE extension by Tomaz/Maddes start // scr_con_current -= scr_conspeed->value*host_frametime; scr_con_current -= scr_conspeed->value*host_cpu_frametime; // 2001-10-20 TIMESCALE extension by Tomaz/Maddes end if (scr_conlines > scr_con_current) scr_con_current = scr_conlines; } else if (scr_conlines > scr_con_current) { // 2001-10-20 TIMESCALE extension by Tomaz/Maddes start // scr_con_current += scr_conspeed->value*host_frametime; scr_con_current += scr_conspeed->value*host_cpu_frametime; // 2001-10-20 TIMESCALE extension by Tomaz/Maddes end if (scr_conlines < scr_con_current) scr_con_current = scr_conlines; } if (clearconsole++ < vid.numpages) { Sbar_Changed (); } else if (clearnotify++ < vid.numpages) { } else con_notifylines = 0; }
/* * SCR_UpdateScreen * * This is called every frame, and can also be called explicitly to flush * text to the screen. */ void SCR_UpdateScreen( void ) { static dynvar_t *updatescreen = NULL; int numframes; int i; float separation[2]; qboolean scr_cinematic; if( !updatescreen ) updatescreen = Dynvar_Create( "updatescreen", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY ); // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if( cls.disable_screen ) { if( Sys_Milliseconds() - cls.disable_screen > 120000 ) { cls.disable_screen = 0; Com_Printf( "Loading plaque timed out.\n" ); } return; } if( !scr_initialized || !con_initialized || !cls.mediaInitialized ) return; // not initialized yet Con_CheckResize(); /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ if( cl_stereo_separation->value > 1.0 ) Cvar_SetValue( "cl_stereo_separation", 1.0 ); else if( cl_stereo_separation->value < 0 ) Cvar_SetValue( "cl_stereo_separation", 0.0 ); if( cl_stereo->integer ) { numframes = 2; separation[0] = -cl_stereo_separation->value / 2; separation[1] = cl_stereo_separation->value / 2; } else { separation[0] = 0; separation[1] = 0; numframes = 1; } // avoid redrawing fullscreen cinematics unless damaged by console drawing scr_cinematic = cls.state == CA_CINEMATIC ? qtrue : qfalse; // if( scr_cinematic && !cl.cin.redraw && !scr_con_current && !scr_con_previous ) { // return; // } if( cls.cgameActive && cls.state < CA_LOADING ) { // this is when we've finished loading cgame media and are waiting // for the first valid snapshot to arrive. keep the loading screen untouched return; } for( i = 0; i < numframes; i++ ) { R_BeginFrame( separation[i], scr_cinematic || scr_forceclear->integer ? qtrue : qfalse ); if( scr_draw_loading == 2 ) { // loading plaque over black screen scr_draw_loading = 0; CL_UIModule_UpdateConnectScreen( qtrue ); } // if a cinematic is supposed to be running, handle menus // and console specially else if( scr_cinematic ) { SCR_DrawCinematic(); SCR_DrawConsole(); } else if( cls.state == CA_DISCONNECTED ) { CL_UIModule_Refresh( qtrue, qtrue ); SCR_DrawConsole(); } else if( cls.state == CA_GETTING_TICKET || cls.state == CA_CONNECTING || cls.state == CA_CONNECTED || cls.state == CA_HANDSHAKE ) { CL_UIModule_UpdateConnectScreen( qtrue ); } else if( cls.state == CA_LOADING ) { SCR_RenderView( separation[i] ); CL_UIModule_UpdateConnectScreen( qfalse ); } else if( cls.state == CA_ACTIVE ) { SCR_RenderView( separation[i] ); CL_UIModule_Refresh( qfalse, qtrue ); if( scr_timegraph->integer ) SCR_DebugGraph( cls.frametime*300, 1, 1, 1 ); if( scr_debuggraph->integer || scr_timegraph->integer || scr_netgraph->integer ) SCR_DrawDebugGraph(); SCR_DrawConsole(); } // wsw : aiwa : call any listeners so they can draw their stuff Dynvar_CallListeners( updatescreen, NULL ); R_EndFrame(); } }
/* * SCR_UpdateScreen * * This is called every frame, and can also be called explicitly to flush * text to the screen. */ void SCR_UpdateScreen( void ) { static dynvar_t *updatescreen = NULL; int numframes; int i; float separation[2]; bool cinematic; bool forcevsync, forceclear; if( !updatescreen ) updatescreen = Dynvar_Create( "updatescreen", false, DYNVAR_WRITEONLY, DYNVAR_READONLY ); // if the screen is disabled (loading plaque is up, or vid mode changing) // do nothing at all if( cls.disable_screen ) { if( Sys_Milliseconds() - cls.disable_screen > 120000 ) { cls.disable_screen = 0; Com_Printf( "Loading plaque timed out.\n" ); } return; } if( !scr_initialized || !con_initialized || !cls.mediaInitialized || !re.ScreenEnabled() ) return; // not ready yet Con_CheckResize(); SCR_CheckSystemFontsModified(); /* ** range check cl_camera_separation so we don't inadvertently fry someone's ** brain */ if( cl_stereo_separation->value > 1.0 ) Cvar_SetValue( "cl_stereo_separation", 1.0 ); else if( cl_stereo_separation->value < 0 ) Cvar_SetValue( "cl_stereo_separation", 0.0 ); if( cl_stereo->integer ) { numframes = 2; separation[0] = -cl_stereo_separation->value / 2; separation[1] = cl_stereo_separation->value / 2; } else { separation[0] = 0; separation[1] = 0; numframes = 1; } cinematic = cls.state == CA_CINEMATIC ? true : false; forcevsync = cinematic; forceclear = cinematic; for( i = 0; i < numframes; i++ ) { re.BeginFrame( separation[i], forceclear, forcevsync ); if( scr_draw_loading == 2 ) { // loading plaque over APP_STARTUP_COLOR screen scr_draw_loading = 0; CL_UIModule_UpdateConnectScreen( true ); } // if a cinematic is supposed to be running, handle menus // and console specially else if( cinematic ) { SCR_DrawCinematic(); SCR_DrawConsole(); } else if( cls.state == CA_DISCONNECTED ) { CL_UIModule_Refresh( true, true ); SCR_DrawConsole(); } else if( cls.state == CA_GETTING_TICKET || cls.state == CA_CONNECTING || cls.state == CA_HANDSHAKE ) { CL_UIModule_UpdateConnectScreen( true ); } else if( cls.state == CA_CONNECTED ) { if( cls.cgameActive ) { CL_UIModule_UpdateConnectScreen( false ); SCR_RenderView( separation[i] ); } else { CL_UIModule_UpdateConnectScreen( true ); } } else if( cls.state == CA_ACTIVE ) { SCR_RenderView( separation[i] ); CL_UIModule_Refresh( false, true ); if( scr_timegraph->integer ) SCR_DebugGraph( cls.frametime*300, 1, 1, 1 ); if( scr_debuggraph->integer || scr_timegraph->integer || scr_netgraph->integer ) SCR_DrawDebugGraph(); SCR_DrawConsole(); } // wsw : aiwa : call any listeners so they can draw their stuff Dynvar_CallListeners( updatescreen, NULL ); re.EndFrame(); } }
/* ================ CL_ConsolePrint Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window ================ */ void CL_ConsolePrint( const char *txt) { int y; int c, l; int color; qboolean skipnotify = qfalse; // NERVE - SMF int prev; // NERVE - SMF // TTimo - prefix for text that shows up in console but not in notify // backported from RTCW if ( !Q_strncmp( txt, "[skipnotify]", 12 ) ) { skipnotify = qtrue; txt += 12; } if ( txt[0] == '*' ) { skipnotify = qtrue; txt += 1; } // for some demos we don't want to ever show anything on the console if ( cl_noprint && cl_noprint->integer ) { return; } if (!con.initialized) { con.color[0] = con.color[1] = con.color[2] = con.color[3] = 1.0f; con.linewidth = -1; Con_CheckResize (); con.initialized = qtrue; } //color = ColorIndex(COLOR_WHITE); color = 0xfff00000; while ( (c = (unsigned char) *txt) != 0 ) { vec4_t newColor; int colorLen = Q_parseColorString( txt, newColor ); if ( colorLen ) { color = Q_PackRGB( newColor ); txt += colorLen; continue; } // count word length for (l=0 ; l< con.linewidth ; l++) { if ( txt[l] <= ' ') { break; } } // word wrap if (l != con.linewidth && (con.x + l >= con.linewidth) ) { Con_Linefeed(skipnotify); } txt++; switch (c) { case '\n': Con_Linefeed (skipnotify); break; case '\r': con.x = 0; break; default: // display character and advance y = con.current % con.totallines; con.text[y*con.linewidth+con.x] = color | c; con.x++; if (con.x >= con.linewidth) { Con_Linefeed(skipnotify); } break; } } // mark time for transparent overlay if (con.current >= 0 ) { // NERVE - SMF if ( skipnotify ) { prev = con.current % NUM_CON_TIMES - 1; if ( prev < 0 ) prev = NUM_CON_TIMES - 1; con.times[prev] = 0; } else // -NERVE - SMF con.times[con.current % NUM_CON_TIMES] = cls.realtime; } }