summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_draw.c94
-rw-r--r--ui/menudef.h41
-rw-r--r--ui/tremulous_alien_common_hud.h15
-rw-r--r--ui/tremulous_default_hud.menu16
-rw-r--r--ui/tremulous_human_hud.menu16
5 files changed, 113 insertions, 69 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
diff --git a/ui/menudef.h b/ui/menudef.h
index f324c046..fd1f1e5f 100644
--- a/ui/menudef.h
+++ b/ui/menudef.h
@@ -101,26 +101,27 @@
#define CG_PLAYER_BUILD_TIMER 4
#define CG_PLAYER_CREDITS_VALUE 7
#define CG_PLAYER_CREDITS_VALUE_NOPAD 9
-#define CG_PLAYER_STAMINA 11
-#define CG_PLAYER_STAMINA_1 12
-#define CG_PLAYER_STAMINA_2 13
-#define CG_PLAYER_STAMINA_3 14
-#define CG_PLAYER_STAMINA_4 15
-#define CG_PLAYER_STAMINA_BOLT 16
-#define CG_PLAYER_BOOST_BOLT 17
-#define CG_PLAYER_CLIPS_RING 18
-#define CG_PLAYER_BUILD_TIMER_RING 19
-#define CG_PLAYER_SELECT 20
-#define CG_PLAYER_SELECTTEXT 21
-#define CG_PLAYER_WEAPONICON 22
-#define CG_PLAYER_WALLCLIMBING 23
-#define CG_PLAYER_BOOSTED 24
-#define CG_PLAYER_POISON_BARBS 25
-#define CG_PLAYER_ALIEN_SENSE 26
-#define CG_PLAYER_HUMAN_SCANNER 27
-#define CG_PLAYER_USABLE_BUILDABLE 28
-#define CG_KILLER 29
-#define CG_SPECTATORS 30
+#define CG_PLAYER_STAMINA 10
+#define CG_PLAYER_STAMINA_1 11
+#define CG_PLAYER_STAMINA_2 12
+#define CG_PLAYER_STAMINA_3 13
+#define CG_PLAYER_STAMINA_4 14
+#define CG_PLAYER_STAMINA_BOLT 15
+#define CG_PLAYER_BOOST_BOLT 16
+#define CG_PLAYER_CLIPS_RING 17
+#define CG_PLAYER_BUILD_TIMER_RING 18
+#define CG_PLAYER_SELECT 19
+#define CG_PLAYER_SELECTTEXT 20
+#define CG_PLAYER_WEAPONICON 21
+#define CG_PLAYER_WALLCLIMBING 22
+#define CG_PLAYER_BOOSTED 23
+#define CG_PLAYER_POISON_BARBS 24
+#define CG_PLAYER_ALIEN_SENSE 25
+#define CG_PLAYER_HUMAN_SCANNER 26
+#define CG_PLAYER_USABLE_BUILDABLE 27
+#define CG_KILLER 28
+#define CG_SPECTATORS 29
+#define CG_FOLLOW 30
// loading screen
#define CG_LOAD_LEVELSHOT 31
diff --git a/ui/tremulous_alien_common_hud.h b/ui/tremulous_alien_common_hud.h
index 04ffb635..5b731faa 100644
--- a/ui/tremulous_alien_common_hud.h
+++ b/ui/tremulous_alien_common_hud.h
@@ -225,3 +225,18 @@ itemDef
background "ui/assets/neutral/charge_bg_h.tga"
}
+//SPECTATOR TEXT
+itemDef
+{
+ name "followtext"
+ rect 200 375 240 25
+ foreColor 1 1 1 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_CENTER
+ textvalign VALIGN_TOP
+ visible MENU_TRUE
+ decoration
+ textScale .7
+ textStyle ITEM_TEXTSTYLE_SHADOWED
+ ownerdraw CG_FOLLOW
+}
diff --git a/ui/tremulous_default_hud.menu b/ui/tremulous_default_hud.menu
index 6c98e519..8d1034b0 100644
--- a/ui/tremulous_default_hud.menu
+++ b/ui/tremulous_default_hud.menu
@@ -17,5 +17,21 @@
#define COMMON_HUD_G 1.0
#define COMMON_HUD_B 1.0
#include "ui/tremulous_common_hud.h"
+
+ //SPECTATOR TEXT
+ itemDef
+ {
+ name "spectatortext"
+ text "SPECTATOR"
+ rect 200 415 240 25
+ foreColor 1 1 1 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_CENTER
+ textvalign VALIGN_TOP
+ visible MENU_TRUE
+ decoration
+ textScale .7
+ textStyle ITEM_TEXTSTYLE_SHADOWED
+ }
}
}
diff --git a/ui/tremulous_human_hud.menu b/ui/tremulous_human_hud.menu
index e38a25ce..57039f38 100644
--- a/ui/tremulous_human_hud.menu
+++ b/ui/tremulous_human_hud.menu
@@ -356,5 +356,21 @@
style WINDOW_STYLE_SHADER
background "ui/assets/neutral/selected.tga"
}
+
+ //SPECTATOR TEXT
+ itemDef
+ {
+ name "followtext"
+ rect 200 375 240 25
+ foreColor 1 1 1 1
+ aspectBias ALIGN_CENTER
+ textalign ALIGN_CENTER
+ textvalign VALIGN_TOP
+ visible MENU_TRUE
+ decoration
+ textScale .7
+ textStyle ITEM_TEXTSTYLE_SHADOWED
+ ownerdraw CG_FOLLOW
+ }
}
}