diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-11 08:07:53 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:47 +0000 |
commit | 3d5b5d3aecc13d937cc7bcf861c0faa4161a2470 (patch) | |
tree | 7a246f0fa4b3de68607808f5af3243566a6e2eb1 /src | |
parent | 9d8cf617d4a9c318e8c07f717df60973c4ec274c (diff) |
* Prevent location hud item from being cut off incorrectly
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index ea7d0a1c..780ac7ed 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2261,6 +2261,7 @@ static void CG_DrawLocation( rectDef_t *rect, float scale, int textalign, vec4_t float maxX; float tx = rect->x, ty = rect->y; maxX = rect->x + rect->w; + qboolean aligned = qfalse; locent = CG_GetPlayerLocation( ); if( locent ) @@ -2269,9 +2270,15 @@ static void CG_DrawLocation( rectDef_t *rect, float scale, int textalign, vec4_t location = CG_ConfigString( CS_LOCATIONS ); if( UI_Text_Width( location, scale, 0 ) < rect->w ) + { CG_AlignText( rect, location, scale, 0.0f, 0.0f, textalign, VALIGN_CENTER, &tx, &ty ); + aligned = qtrue; + } - UI_Text_Paint_Limit( &maxX, tx, ty, scale, color, location, 0, 0 ); + if( aligned && textalign == ALIGN_RIGHT ) // If we aligned right, we're not going to cut off on the right + UI_Text_Paint( tx, ty, scale, color, location, 0, 0, ITEM_TEXTSTYLE_NORMAL ); + else + UI_Text_Paint_Limit( &maxX, tx, ty, scale, color, location, 0, 0 ); trap_R_SetColor( NULL ); } |