From 9671a190ea89feb7103a31c878e31a65494e6736 Mon Sep 17 00:00:00 2001 From: Roman Tetelman Date: Sat, 3 Oct 2009 12:00:52 +0000 Subject: * Add hud support for location entities (ownerdraw CG_PLAYER_LOCATION) * Fix dumb typo left from debugging in last revision --- src/cgame/cg_draw.c | 19 +++++++++++++++++++ ui/menudef.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 223bba86..8f19c341 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2253,6 +2253,22 @@ static void CG_ScanForCrosshairEntity( void ) } +/* +===================== +CG_DrawLocation +===================== +*/ +static void CG_DrawLocation( rectDef_t *rect, float scale, vec4_t color ) +{ + const char *location; + float maxX; + maxX = rect->x + rect->w; + location = CG_ConfigString( CS_LOCATIONS + cgs.clientinfo[ cg.clientNum ].location ); + + UI_Text_Paint_Limit( &maxX, rect->x, rect->y, scale, color, location, 0, 0 ); + trap_R_SetColor( NULL ); +} + /* ===================== CG_DrawCrosshairNames @@ -2403,6 +2419,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, case CG_SPECTATORS: CG_DrawTeamSpectators( &rect, scale, textvalign, color, shader ); break; + case CG_PLAYER_LOCATION: + CG_DrawLocation( &rect, scale, color ); + break; case CG_PLAYER_CROSSHAIRNAMES: CG_DrawCrosshairNames( &rect, scale, textStyle ); break; diff --git a/ui/menudef.h b/ui/menudef.h index 629655bf..6290cf42 100644 --- a/ui/menudef.h +++ b/ui/menudef.h @@ -178,5 +178,6 @@ #define CG_PLAYER_CHARGE_BAR_BG 76 #define CG_PLAYER_CHARGE_BAR 77 #define CG_PLAYER_CROSSHAIR 78 +#define CG_PLAYER_LOCATION 79 #endif -- cgit