diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_buildable.c | 9 | ||||
-rw-r--r-- | src/cgame/cg_consolecmds.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_drawtools.c | 15 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 16 |
5 files changed, 23 insertions, 25 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index db6eb539..8a5bb858 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -973,6 +973,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) float picY = y; float scale; float subH, subY; + float clipX, clipY, clipW, clipH; vec4_t frameColor; // this is fudged to get the width/height in the cfg to be more realistic @@ -990,6 +991,12 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) subH = picH - ( picH * bs->verticalMargin ); subY = picY + ( picH * 0.5f ) - ( subH * 0.5f ); + clipW = ( 640.0f * cg_viewsize.integer ) / 100.0f; + clipH = ( 480.0f * cg_viewsize.integer ) / 100.0f; + clipX = 320.0f - ( clipW * 0.5f ); + clipY = 240.0f - ( clipH * 0.5f ); + CG_SetClipRegion( clipX, clipY, clipW, clipH ); + if( bs->frameShader ) { Vector4Copy( bs->backColor, frameColor ); @@ -1083,7 +1090,9 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) CG_DrawField( nX, subY, 4, subH, subH, healthPoints ); } + trap_R_SetColor( NULL ); + CG_ClearClipRegion( ); } } diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 524d3412..17eddac1 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -38,7 +38,7 @@ Keybinding command */ static void CG_SizeUp_f( void ) { - trap_Cvar_Set( "cg_viewsize", va( "%i", (int)( cg_viewsize.integer + 10 ) ) ); + trap_Cvar_Set( "cg_viewsize", va( "%i", MIN( cg_viewsize.integer + 10, 100 ) ) ); } @@ -51,7 +51,7 @@ Keybinding command */ static void CG_SizeDown_f( void ) { - trap_Cvar_Set( "cg_viewsize", va( "%i", (int)( cg_viewsize.integer - 10 ) ) ); + trap_Cvar_Set( "cg_viewsize", va( "%i", MAX( cg_viewsize.integer - 10, 30 ) ) ); } diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index cd6d7cfc..2cb4e305 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -36,7 +36,7 @@ static void CG_AlignText( rectDef_t *rect, const char *text, float scale, float *x, float *y ) { float tx, ty; - + if( scale > 0.0f ) { w = UI_Text_Width( text, scale, 0 ); @@ -1318,7 +1318,7 @@ static void CG_DrawFollow( rectDef_t *rect, float text_x, float text_y, { float tx, ty; - if( cg.snap->ps.pm_flags & PMF_FOLLOW ) + if( cg.snap && cg.snap->ps.pm_flags & PMF_FOLLOW ) { char buffer[ MAX_STRING_CHARS ]; diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index 726c4de9..5a6129df 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -358,18 +358,18 @@ qboolean CG_WorldToScreen( vec3_t point, float *x, float *y ) VectorSubtract( point, cg.refdef.vieworg, trans ); - xc = 640.0f / 2.0f; - yc = 480.0f / 2.0f; + xc = ( 640.0f * cg_viewsize.integer ) / 200.0f; + yc = ( 480.0f * cg_viewsize.integer ) / 200.0f; z = DotProduct( trans, cg.refdef.viewaxis[ 0 ] ); if( z <= 0.001f ) return qfalse; if( x ) - *x = xc - DotProduct( trans, cg.refdef.viewaxis[ 1 ] ) * xc / ( z * px ); + *x = 320.0f - DotProduct( trans, cg.refdef.viewaxis[ 1 ] ) * xc / ( z * px ); if( y ) - *y = yc - DotProduct( trans, cg.refdef.viewaxis[ 2 ] ) * yc / ( z * py ); + *y = 240.0f - DotProduct( trans, cg.refdef.viewaxis[ 2 ] ) * yc / ( z * py ); return qtrue; } @@ -386,6 +386,7 @@ char *CG_KeyBinding( const char *bind ) int i; key[ 0 ] = '\0'; + // NOTE: change K_LAST_KEY to MAX_KEYS for full key support (eventually) for( i = 0; i < K_LAST_KEY; i++ ) { @@ -394,13 +395,15 @@ char *CG_KeyBinding( const char *bind ) { trap_Key_KeynumToStringBuf( i, key, sizeof( key ) ); break; - } + } } + if( !key[ 0 ] ) { Q_strncpyz( key, "\\", sizeof( key ) ); Q_strcat( key, sizeof( key ), bind ); } + return key; } @@ -421,7 +424,7 @@ char CG_GetColorCharForHealth( int clientnum ) else maxHealth = BG_Class( PCL_HUMAN )->health; - healthPercent = (int) ( 100.0f * (float) cgs.clientinfo[ clientnum ].health / + healthPercent = (int) ( 100.0f * (float) cgs.clientinfo[ clientnum ].health / (float) maxHealth ); if( healthPercent < 33 ) diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 02284fca..c5096f57 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -229,21 +229,7 @@ static void CG_CalcVrect( void ) if( cg.snap->ps.pm_type == PM_INTERMISSION ) size = 100; else - { - // bound normal viewsize - if( cg_viewsize.integer < 30 ) - { - trap_Cvar_Set( "cg_viewsize", "30" ); - size = 30; - } - else if( cg_viewsize.integer > 100 ) - { - trap_Cvar_Set( "cg_viewsize","100" ); - size = 100; - } - else - size = cg_viewsize.integer; - } + size = cg_viewsize.integer; cg.refdef.width = cgs.glconfig.vidWidth * size / 100; cg.refdef.width &= ~1; |