diff options
-rw-r--r-- | source/cl_draw.c | 2 | ||||
-rw-r--r-- | source/cl_input.c | 4 | ||||
-rw-r--r-- | source/cl_keys.c | 2 | ||||
-rw-r--r-- | source/cl_main.c | 2 | ||||
-rw-r--r-- | source/cl_scrn.c | 25 | ||||
-rw-r--r-- | source/com_local.h | 1 | ||||
-rw-r--r-- | source/gl_draw.c | 4 | ||||
-rw-r--r-- | source/gl_local.h | 2 | ||||
-rw-r--r-- | source/gl_mesh.c | 6 | ||||
-rw-r--r-- | source/gl_state.c | 13 | ||||
-rw-r--r-- | source/gl_tess.c | 20 | ||||
-rw-r--r-- | source/sv_main.c | 2 |
12 files changed, 63 insertions, 20 deletions
diff --git a/source/cl_draw.c b/source/cl_draw.c index 1956609..311a7c7 100644 --- a/source/cl_draw.c +++ b/source/cl_draw.c @@ -490,6 +490,8 @@ void SCR_Draw2D( void ) { draw_turtle(); } + SCR_DrawPause(); + if( scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) { ref.SetClipRect( DRAW_CLIP_DISABLED, NULL ); } diff --git a/source/cl_input.c b/source/cl_input.c index eee7be7..cc4480d 100644 --- a/source/cl_input.c +++ b/source/cl_input.c @@ -111,8 +111,8 @@ void CL_InputActivate( void ) { return; } - if( ( cls.key_dest & KEY_CONSOLE ) && !( scr_glconfig.flags & QVF_FULLSCREEN ) ) { - // deactivate in windowed mode if console is open + if( ( ( cls.key_dest & KEY_CONSOLE ) || ( !( cls.key_dest & KEY_MENU ) && sv_paused->integer ) ) && !( scr_glconfig.flags & QVF_FULLSCREEN ) ) { + // deactivate in windowed mode if console is open or game is paused active = qfalse; } diff --git a/source/cl_keys.c b/source/cl_keys.c index 5591100..e243fde 100644 --- a/source/cl_keys.c +++ b/source/cl_keys.c @@ -232,7 +232,7 @@ void Key_SetDest( keydest_t dest ) { } // activate or deactivate mouse - if( diff & KEY_CONSOLE ) { + if( diff & (KEY_CONSOLE|KEY_MENU) ) { CL_InputActivate(); } } diff --git a/source/cl_main.c b/source/cl_main.c index 2a36b16..1e62c65 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -2584,10 +2584,12 @@ void CL_Frame( int msec ) { if( cl_paused->integer ) { if( !sv_paused->integer ) { Cvar_Set( "sv_paused", "1" ); + CL_InputActivate(); } } else { if( sv_paused->integer ) { Cvar_Set( "sv_paused", "0" ); + CL_InputActivate(); } } } diff --git a/source/cl_scrn.c b/source/cl_scrn.c index ea2d202..e44b237 100644 --- a/source/cl_scrn.c +++ b/source/cl_scrn.c @@ -49,7 +49,10 @@ qhandle_t crosshair_pic; int crosshair_width, crosshair_height; qhandle_t scr_backtile; + qhandle_t scr_pause; +int scr_pause_width, scr_pause_height; + qhandle_t scr_net; qhandle_t scr_font; @@ -189,11 +192,7 @@ static void SCR_DrawPercentBar( int percent ) { ref.DrawFill( 0, scr_hudHeight, w, CHAR_HEIGHT, 4 ); ref.DrawFill( w, scr_hudHeight, scr_hudWidth - w, CHAR_HEIGHT, 0 ); - if( sv_paused->integer ) { - length = sprintf( buffer, "[%d%%]", percent ); - } else { - length = sprintf( buffer, "%d%%", percent ); - } + length = sprintf( buffer, "%d%%", percent ); x = ( scr_hudWidth - length * CHAR_WIDTH ) / 2; ref.DrawString( x, scr_hudHeight, 0, MAX_STRING_CHARS, buffer, scr_font ); } @@ -439,6 +438,8 @@ void SCR_RegisterMedia( void ) { scr_pause = ref.RegisterPic( "pause" ); scr_net = ref.RegisterPic( "net" ); scr_font = ref.RegisterFont( scr_fontvar->string ); + + ref.DrawGetPicSize( &scr_pause_width, &scr_pause_height, scr_pause ); } static void scr_fontvar_changed( cvar_t *self ) { @@ -492,23 +493,21 @@ SCR_DrawPause ============== */ void SCR_DrawPause( void ) { - int x, y, w, h; + int x, y; if( !sv_paused->integer ) { return; } + if( cl_paused->integer != 2 ) { + return; + } if( !scr_showpause->integer ) { // turn off for screenshots return; } - if( cls.key_dest & KEY_MENU ) { - return; - } - - ref.DrawGetPicSize( &w, &h, scr_pause ); - x = ( scr_glconfig.vidWidth - w ) / 2; - y = scr_glconfig.vidHeight / 2 + 8; + x = ( scr_hudWidth - scr_pause_width ) / 2; + y = ( scr_hudHeight - scr_pause_height ) / 2; ref.DrawPic( x, y, scr_pause ); } diff --git a/source/com_local.h b/source/com_local.h index cc337f3..e783c36 100644 --- a/source/com_local.h +++ b/source/com_local.h @@ -1052,6 +1052,7 @@ void SCR_ModeChanged( void ); void CL_LocalConnect( void ); void CL_RestartFilesystem( void ); void CL_InputFrame( void ); +void CL_InputActivate( void ); void CL_AppActivate( qboolean active ); void CL_UpdateUserinfo( cvar_t *var, cvarSetSource_t source ); diff --git a/source/gl_draw.c b/source/gl_draw.c index 2df1b55..388019f 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -105,8 +105,8 @@ void Draw_GetPicSize( int *w, int *h, qhandle_t hPic ) { image_t *image; image = R_ImageForHandle( hPic ); - *w = image->upload_width; - *h = image->upload_height; + *w = image->width; + *h = image->height; } void Draw_GetFontSize( int *w, int *h, qhandle_t hFont ) { diff --git a/source/gl_local.h b/source/gl_local.h index 3017dd3..0c4cb78 100644 --- a/source/gl_local.h +++ b/source/gl_local.h @@ -254,6 +254,8 @@ void GL_InitPrograms( void ); void GL_ShutdownPrograms( void ); void GL_EnableWarp( void ); void GL_DisableWarp( void ); +void GL_EnableOutlines( void ); +void GL_DisableOutlines( void ); /* diff --git a/source/gl_mesh.c b/source/gl_mesh.c index e42599d..6296055 100644 --- a/source/gl_mesh.c +++ b/source/gl_mesh.c @@ -397,8 +397,10 @@ void GL_DrawAliasModel( model_t *model ) { #endif if( gl_showtris->integer ) { - //Tess_DrawSurfaceTriangles( ( int * )mesh->indices, - // mesh->numIndices ); + GL_EnableOutlines(); + qglDrawElements( GL_TRIANGLES, mesh->numIndices, GL_UNSIGNED_INT, + mesh->indices ); + GL_DisableOutlines(); } if( qglUnlockArraysEXT ) { qglUnlockArraysEXT(); diff --git a/source/gl_state.c b/source/gl_state.c index b7a4b14..9973c93 100644 --- a/source/gl_state.c +++ b/source/gl_state.c @@ -266,6 +266,19 @@ void GL_SetDefaultState( void ) { GL_Bits( GLS_DEFAULT ); } +void GL_EnableOutlines( void ) { + qglDisable( GL_TEXTURE_2D ); + qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + qglDisable( GL_DEPTH_TEST ); + qglColor4f( 1, 1, 1, 1 ); +} + +void GL_DisableOutlines( void ) { + qglEnable( GL_DEPTH_TEST ); + qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + qglEnable( GL_TEXTURE_2D ); +} + void GL_EnableWarp( void ) { vec4_t param; diff --git a/source/gl_tess.c b/source/gl_tess.c index 76717aa..eda9706 100644 --- a/source/gl_tess.c +++ b/source/gl_tess.c @@ -51,9 +51,23 @@ void GL_Flush2D( void ) { qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.colors ); qglTexCoordPointer( 2, GL_FLOAT, 0, tess.tcoords ); qglVertexPointer( 3, GL_FLOAT, 16, tess.vertices ); + + if( qglLockArraysEXT ) { + qglLockArraysEXT( 0, tess.numVertices ); + } qglDrawArrays( GL_QUADS, 0, tess.numVertices ); + if( gl_showtris->integer ) { + GL_EnableOutlines(); + qglDrawArrays( GL_QUADS, 0, tess.numVertices ); + GL_DisableOutlines(); + } + + if( qglUnlockArraysEXT ) { + qglUnlockArraysEXT(); + } + qglDisableClientState( GL_COLOR_ARRAY ); tess.numVertices = 0; @@ -308,6 +322,12 @@ static void GL_Flush3D( void ) { GL_SelectTMU( 0 ); } + if( gl_showtris->integer ) { + GL_EnableOutlines(); + qglDrawElements( GL_TRIANGLES, tess.numIndices, GL_UNSIGNED_INT, tess.indices ); + GL_DisableOutlines(); + } + c.batchesDrawn++; tess.texnum[0] = tess.texnum[1] = 0; diff --git a/source/sv_main.c b/source/sv_main.c index 89c04a1..89529a8 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -1364,6 +1364,7 @@ static qboolean SV_CheckPaused( void ) { } if( !sv_paused->integer ) { Cvar_Set( "sv_paused", "1" ); + CL_InputActivate(); } return qtrue; // don't run if paused } @@ -1371,6 +1372,7 @@ static qboolean SV_CheckPaused( void ) { nopause: if( sv_paused->integer ) { Cvar_Set( "sv_paused", "0" ); + CL_InputActivate(); } return qfalse; } |