summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-22 08:25:20 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:00 +0000
commit0cc4070263c9159760901dcb5e2b1ac6d97de86f (patch)
treeb5113e43fefc69c6d6c0ad00ee1ccac8f144e9f2
parent3c9a869327aecda255ffc48ba7a7f4bcf6b4544e (diff)
* Fix UI_Text_Paint_Limit() function, which was printing a max of one character ever, but nothing was using it so nobody noticed (thanks Oopss)
* Add ALIGN_NONE and VALIGN_NONE types for CG_Text_Align function * Slightly widen the location item on the default hud, since just a little bit more fits most maps better * Prevent seeing crosshair playername text for players on the other team while in SPECTATOR_LOCKED * Fix formatting nitpick from a few revisions ago
-rw-r--r--assets/ui/menudef.h7
-rw-r--r--assets/ui/tremulous_common_hud.h2
-rw-r--r--src/cgame/cg_draw.c18
-rw-r--r--src/cgame/cg_servercmds.c4
-rw-r--r--src/ui/ui_shared.c5
5 files changed, 24 insertions, 12 deletions
diff --git a/assets/ui/menudef.h b/assets/ui/menudef.h
index 3adc8a1a..7e5074f7 100644
--- a/assets/ui/menudef.h
+++ b/assets/ui/menudef.h
@@ -21,19 +21,22 @@ enum
ITEM_TYPE_BIND // keyboard control configuration
};
+// The first items in these enums are the defaults if menus do not specify
enum
{
ALIGN_LEFT, // left alignment
ALIGN_CENTER, // center alignment
ALIGN_RIGHT, // right alignment
- ASPECT_NONE // no aspect compensation
+ ASPECT_NONE, // no aspect compensation
+ ALIGN_NONE
};
enum
{
VALIGN_BOTTOM, // bottom alignment
VALIGN_CENTER, // center alignment
- VALIGN_TOP // top alignment
+ VALIGN_TOP, // top alignment
+ VALIGN_NONE
};
enum
diff --git a/assets/ui/tremulous_common_hud.h b/assets/ui/tremulous_common_hud.h
index 4ef4dbb9..d4c69f08 100644
--- a/assets/ui/tremulous_common_hud.h
+++ b/assets/ui/tremulous_common_hud.h
@@ -127,7 +127,7 @@ itemDef
itemDef
{
name "location"
- rect (STAT_X-60) ((4*BORDER)+(4*STAT_H)) (STAT_W+60) STAT_H
+ rect (STAT_X-75) ((4*BORDER)+(4*STAT_H)) (STAT_W+75) STAT_H
aspectBias ALIGN_RIGHT
visible MENU_TRUE
decoration
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 6609d153..da5d9101 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -57,6 +57,10 @@ static void CG_AlignText( rectDef_t *rect, const char *text, float scale,
case ALIGN_CENTER:
tx = ( rect->w - w ) / 2.0f;
break;
+
+ case ALIGN_NONE:
+ tx = 0;
+ break;
}
switch( valign )
@@ -73,6 +77,10 @@ static void CG_AlignText( rectDef_t *rect, const char *text, float scale,
case VALIGN_CENTER:
ty = h + ( ( rect->h - h ) / 2.0f );
break;
+
+ case VALIGN_NONE:
+ ty = 0;
+ break;
}
if( x )
@@ -2430,7 +2438,7 @@ static void CG_ScanForCrosshairEntity( void )
team = cgs.clientinfo[ trace.entityNum ].team;
- if( cg.snap->ps.persistant[ PERS_SPECSTATE ] == SPECTATOR_NOT )
+ if( cg.snap->ps.stats[ STAT_TEAM ] != TEAM_NONE )
{
//only display team names of those on the same team as this player
if( team != cg.snap->ps.stats[ STAT_TEAM ] )
@@ -2463,13 +2471,13 @@ static void CG_DrawLocation( rectDef_t *rect, float scale, int textalign, vec4_t
else
location = CG_ConfigString( CS_LOCATIONS );
+ // need to skip horiz. align if it's too long, but valign must be run either way
if( UI_Text_Width( location, scale, 0 ) < rect->w )
- {
CG_AlignText( rect, location, scale, 0.0f, 0.0f, textalign, VALIGN_CENTER, &tx, &ty );
- 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 );
+ CG_AlignText( rect, location, scale, 0.0f, 0.0f, ALIGN_NONE, VALIGN_CENTER, &tx, &ty );
+
+ UI_Text_Paint_Limit( &maxX, tx, ty, scale, color, location, 0, 0 );
trap_R_SetColor( NULL );
}
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 9af97006..3e4ebaae 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -940,8 +940,8 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text )
Com_sprintf( prefix, sizeof( prefix ), "[^%c%c" S_COLOR_WHITE "] " S_COLOR_WHITE,
tcolor, toupper( *( BG_TeamName( ci->team ) ) ) );
- if( ci && ( mode == SAY_TEAM || mode == SAY_AREA )
- && cg.snap->ps.pm_type != PM_INTERMISSION )
+ if( ci && ( mode == SAY_TEAM || mode == SAY_AREA ) &&
+ cg.snap->ps.pm_type != PM_INTERMISSION )
{
if( clientNum == cg.snap->ps.clientNum )
{
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 524df189..6e046147 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -2192,10 +2192,11 @@ static void UI_Text_Paint_Generic( float x, float y, float scale, float gapAdjus
s++;
count++;
- if( maxX )
- *maxX = x;
}
+ if( maxX )
+ *maxX = x;
+
// paint cursor
if( cursorPos >= 0 )
{