summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c34
-rw-r--r--src/cgame/cg_local.h2
2 files changed, 18 insertions, 18 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index f7c1f188..223bba86 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -2140,20 +2140,13 @@ CROSSHAIR
*/
-const vec4_t crosshairColours[ ] =
-{
- { 1.0f, 0.0f, 0.0f, 0.35f }, // alien normal
- { 0.5f, 0.0f, 0.0f, 0.35f }, // alien team
- { 0.0f, 0.8f, 1.0f, 0.35f }, // human normal
- { 0.0f, 0.4f, 0.5f, 0.35f } // human team
-};
/*
=================
CG_DrawCrosshair
=================
*/
-static void CG_DrawCrosshair( void )
+static void CG_DrawCrosshair( rectDef_t *rect, vec4_t color )
{
float w, h;
qhandle_t hShader;
@@ -2182,22 +2175,27 @@ static void CG_DrawCrosshair( void )
w = h = wi->crossHairSize * cg_crosshairSize.value;
w *= cgDC.aspectScale;
-
+
+ //FIXME: find a way to use rect from the hud instead of cg_crosshair[XY]
+ //the different sizes of the crosshairs make this a pain
x = 320 + cg_crosshairX.integer - ( w / 2 );
y = 240 + cg_crosshairY.integer - ( h / 2 );
hShader = wi->crossHair;
+
+ //aiming at a friendly player/buildable, dim the crosshair
+ if( cg.time == cg.crosshairClientTime || cg.crosshairBuildable >= 0 )
+ {
+ int i;
+ for( i = 0; i < 3; i++ )
+ color[i] *= .5f;
+
+ }
if( hShader != 0 )
{
- int colour = 0;
- if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )
- colour += 2;
-
- if( cg.time == cg.crosshairClientTime || cg.crosshairBuildable >= 0 )
- colour += 1;
- trap_R_SetColor( crosshairColours[ colour ] );
+ trap_R_SetColor( color );
CG_DrawPic( x, y, w, h, hShader );
trap_R_SetColor( NULL );
}
@@ -2408,6 +2406,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_CROSSHAIRNAMES:
CG_DrawCrosshairNames( &rect, scale, textStyle );
break;
+ case CG_PLAYER_CROSSHAIR:
+ CG_DrawCrosshair( &rect, color );
+ break;
case CG_STAGE_REPORT_TEXT:
CG_DrawStageReport( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle );
break;
@@ -3021,7 +3022,6 @@ static void CG_Draw2D( void )
if( cg_drawStatus.integer )
Menu_Paint( menu, qtrue );
- CG_DrawCrosshair( );
}
else if( cg_drawStatus.integer )
Menu_Paint( defaultMenu, qtrue );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index bcb7ed70..72a61fc2 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1034,7 +1034,7 @@ typedef struct
// kill timers for carnage reward
int lastKillTime;
- // targeted entity
+ // crosshair client ID
int crosshairBuildable;
int crosshairClientNum;
int crosshairClientTime;