summaryrefslogtreecommitdiff
path: root/src/cgame/cg_drawtools.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-16 22:20:49 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:52 +0000
commit9a60b0c6c2252e95caa35e4b00b310b5e628371b (patch)
treee698b603ca92b2093b06071be602c734b40d1fec /src/cgame/cg_drawtools.c
parentdb2626a08e4d39c58890ba7e3f7c4470e7c0b38b (diff)
* (bug #4265) Fix CG_WorldToScreen to accomdate cg_viewsize
* (bug #4265) Clip health bars to the cg_viewsize viewport
Diffstat (limited to 'src/cgame/cg_drawtools.c')
-rw-r--r--src/cgame/cg_drawtools.c15
1 files changed, 9 insertions, 6 deletions
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 )