summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c94
1 files changed, 45 insertions, 49 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index fbdc747b..d00a41cf 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1381,6 +1381,36 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign,
}
}
+#define FOLLOWING_STRING "following "
+#define CHASING_STRING "chasing "
+
+/*
+==================
+CG_DrawSpectatorText
+==================
+*/
+static void CG_DrawFollow( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int textalign, int textvalign, int textStyle )
+{
+ float tx, ty;
+
+ if( cg.snap->ps.pm_flags & PMF_FOLLOW )
+ {
+ char buffer[ MAX_STRING_CHARS ];
+
+ if( !cg.chaseFollow )
+ strcpy( buffer, FOLLOWING_STRING );
+ else
+ strcpy( buffer, CHASING_STRING );
+
+ strcat( buffer, cgs.clientinfo[ cg.snap->ps.clientNum ].name );
+
+ CG_AlignText( rect, buffer, scale, 0, 0, textalign, textvalign, &tx, &ty );
+ UI_Text_Paint( text_x + tx, text_y + ty, scale, color, buffer, 0, 0,
+ textStyle );
+ }
+}
+
/*
==================
CG_DrawTeamLabel
@@ -2396,6 +2426,10 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_LOCATION:
CG_DrawLocation( &rect, scale, textalign, color );
break;
+ case CG_FOLLOW:
+ CG_DrawFollow( &rect, text_x, text_y, color, scale,
+ textalign, textvalign, textStyle );
+ break;
case CG_PLAYER_CROSSHAIRNAMES:
CG_DrawCrosshairNames( &rect, scale, textStyle );
break;
@@ -2884,40 +2918,6 @@ static void CG_DrawIntermission( void )
cg.scoreBoardShowing = CG_DrawScoreboard( );
}
-#define FOLLOWING_STRING "Following: "
-#define CHASING_STRING "Chasing: "
-
-/*
-=================
-CG_DrawFollow
-=================
-*/
-static qboolean CG_DrawFollow( void )
-{
- float w;
- vec4_t color;
- char buffer[ MAX_STRING_CHARS ];
-
- if( cg.snap->ps.clientNum == cg.clientNum )
- return qfalse;
-
- color[ 0 ] = 1;
- color[ 1 ] = 1;
- color[ 2 ] = 1;
- color[ 3 ] = 1;
-
- if( !cg.chaseFollow )
- strcpy( buffer, FOLLOWING_STRING );
- else
- strcpy( buffer, CHASING_STRING );
- strcat( buffer, cgs.clientinfo[ cg.snap->ps.clientNum ].name );
-
- w = UI_Text_Width( buffer, 0.7f, 0 );
- UI_Text_Paint( 320 - w / 2, 400, 0.7f, color, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
-
- return qtrue;
-}
-
/*
=================
CG_DrawQueue
@@ -2971,7 +2971,6 @@ static qboolean CG_DrawQueue( void )
//==================================================================================
-#define SPECTATOR_STRING "SPECTATOR"
/*
=================
CG_Draw2D
@@ -2979,11 +2978,7 @@ CG_Draw2D
*/
static void CG_Draw2D( void )
{
- vec4_t color;
- float w;
- menuDef_t *menu = NULL, *defaultMenu;
-
- color[ 0 ] = color[ 1 ] = color[ 2 ] = color[ 3 ] = 1.0f;
+ menuDef_t *menu = NULL;
// if we are taking a levelshot for the menu, don't draw anything
if( cg.levelShot )
@@ -3000,17 +2995,19 @@ static void CG_Draw2D( void )
CG_DrawLighting( );
- defaultMenu = Menus_FindByName( "default_hud" );
-
- if( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT )
+ if( cg.snap->ps.persistant[ PERS_SPECSTATE ] == SPECTATOR_NOT )
{
- w = UI_Text_Width( SPECTATOR_STRING, 0.7f, 0 );
- UI_Text_Paint( 320 - w / 2, 440, 0.7f, color, SPECTATOR_STRING, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
+ menu = Menus_FindByName( BG_ClassConfig(
+ cg.predictedPlayerState.stats[ STAT_CLASS ] )->hudName );
}
- else
- menu = Menus_FindByName( BG_ClassConfig( cg.predictedPlayerState.stats[ STAT_CLASS ] )->hudName );
- if( menu && !( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
+ if( !menu )
+ menu = Menus_FindByName( "default_hud" );
+
+ if( !menu ) // still couldn't find it
+ CG_Error( "Default HUD could not be found" );
+
+ if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
( cg.snap->ps.stats[ STAT_HEALTH ] > 0 ) )
{
CG_DrawBuildableStatus( );
@@ -3020,7 +3017,6 @@ static void CG_Draw2D( void )
CG_DrawVote( );
CG_DrawTeamVote( );
- CG_DrawFollow( );
CG_DrawQueue( );
// don't draw center string if scoreboard is up