diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 11:59:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:34 +0000 |
commit | e28bdd7b296c0028aaa63ee1feb027c2f0ebde51 (patch) | |
tree | b1878ac3dac5a78f2f366e88e35f2ee385d7ca86 | |
parent | bae28b3f786d6806287e71479e2ebf185eac36b8 (diff) |
* Crosshairs dim when targeting teammates
* Fix indentation in crosshairs.shader
* remove some hopefully redundant cursordraw stuff
-rw-r--r-- | scripts/crosshairs.shader | 229 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 41 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 3 |
3 files changed, 45 insertions, 228 deletions
diff --git a/scripts/crosshairs.shader b/scripts/crosshairs.shader index e393f245..278a2963 100644 --- a/scripts/crosshairs.shader +++ b/scripts/crosshairs.shader @@ -4,8 +4,7 @@ gfx/2d/crosshair-alien_s { map gfx/2d/crosshair-alien.tga blendfunc blend - rgbgen const ( 1.0 0.0 0.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -15,8 +14,7 @@ gfx/2d/crosshair-rifle_s { map gfx/2d/crosshair-rifle.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -26,8 +24,7 @@ gfx/2d/crosshair-prifle_s { map gfx/2d/crosshair-prifle.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -37,8 +34,7 @@ gfx/2d/crosshair-chaingun_s { map gfx/2d/crosshair-chaingun.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -48,8 +44,7 @@ gfx/2d/crosshair-mdriver_s { map gfx/2d/crosshair-mdriver.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -59,8 +54,7 @@ gfx/2d/crosshair-lcannon_s { map gfx/2d/crosshair-lcannon.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -70,8 +64,7 @@ gfx/2d/crosshair-lgun_s { map gfx/2d/crosshair-lgun.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } } @@ -81,213 +74,14 @@ gfx/2d/crosshair-flamer_s { clampmap gfx/2d/crosshair-flamer1.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 tcmod rotate 5 + rgbGen vertex } { clampmap gfx/2d/crosshair-flamer1.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 - tcmod rotate -5 - } -} -gfx/2d/crosshair-psaw -{ - nopicmip - { - map gfx/2d/crosshair-psaw.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -*** 1,97 **** 0 -gfx/2d/crosshair-alien_s -{ - { - map gfx/2d/crosshair-alien.tga - blendfunc blend - rgbgen const ( 1.0 0.0 0.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-rifle_s -{ - { - map gfx/2d/crosshair-rifle.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-prifle_s -{ - { - map gfx/2d/crosshair-prifle.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-chaingun_s -{ - { - map gfx/2d/crosshair-chaingun.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-mdriver_s -{ - { - map gfx/2d/crosshair-mdriver.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-lcannon_s -{ - { - map gfx/2d/crosshair-lcannon.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-lgun_s -{ - { - map gfx/2d/crosshair-lgun.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-flamer_s -{ - { - clampmap gfx/2d/crosshair-flamer1.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 - tcmod rotate 5 - } - { - clampmap gfx/2d/crosshair-flamer1.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 - tcmod rotate -5 - } -} -gfx/2d/crosshair-psaw -{ - { - map gfx/2d/crosshair-psaw.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -*** 1,97 **** 0 -gfx/2d/crosshair-alien_s -{ - { - map gfx/2d/crosshair-alien.tga - blendfunc blend - rgbgen const ( 1.0 0.0 0.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-rifle_s -{ - { - map gfx/2d/crosshair-rifle.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-prifle_s -{ - { - map gfx/2d/crosshair-prifle.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-chaingun_s -{ - { - map gfx/2d/crosshair-chaingun.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-mdriver_s -{ - { - map gfx/2d/crosshair-mdriver.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-lcannon_s -{ - { - map gfx/2d/crosshair-lcannon.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-lgun_s -{ - { - map gfx/2d/crosshair-lgun.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 - } -} - -gfx/2d/crosshair-flamer_s -{ - { - clampmap gfx/2d/crosshair-flamer1.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 - tcmod rotate 5 - } - { - clampmap gfx/2d/crosshair-flamer1.tga - blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.15 tcmod rotate -5 + rgbGen vertex } } @@ -297,7 +91,6 @@ gfx/2d/crosshair-psaw { map gfx/2d/crosshair-psaw.tga blendfunc blend - rgbgen const ( 0.0 0.8 1.0 ) - alphagen const 0.35 + rgbGen vertex } -} +}
\ No newline at end of file diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 5fcd832a..f7c1f188 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2140,6 +2140,14 @@ 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 @@ -2175,17 +2183,23 @@ static void CG_DrawCrosshair( void ) w = h = wi->crossHairSize * cg_crosshairSize.value; w *= cgDC.aspectScale; - x = cg_crosshairX.integer; - y = cg_crosshairY.integer; - CG_AdjustFrom640( &x, &y, &w, &h ); + x = 320 + cg_crosshairX.integer - ( w / 2 ); + y = 240 + cg_crosshairY.integer - ( h / 2 ); hShader = wi->crossHair; if( hShader != 0 ) { - trap_R_DrawStretchPic( x + cg.refdef.x + 0.5 * ( cg.refdef.width - w ), - y + cg.refdef.y + 0.5 * ( cg.refdef.height - h ), - w, h, 0, 0, 1, 1, hShader ); + 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 ] ); + CG_DrawPic( x, y, w, h, hShader ); + trap_R_SetColor( NULL ); } } @@ -2209,14 +2223,23 @@ static void CG_ScanForCrosshairEntity( void ) CG_Trace( &trace, start, vec3_origin, vec3_origin, end, cg.snap->ps.clientNum, CONTENTS_SOLID|CONTENTS_BODY ); - if( trace.entityNum >= MAX_CLIENTS ) - return; - // if the player is in fog, don't show it content = trap_CM_PointContents( trace.endpos, 0 ); if( content & CONTENTS_FOG ) return; + if( trace.entityNum >= MAX_CLIENTS ) + { + entityState_t *s = &cg_entities[ trace.entityNum ].currentState; + if( s->eType == ET_BUILDABLE && BG_Buildable( s->modelindex )->team == + cg.snap->ps.stats[ STAT_TEAM ] ) + cg.crosshairBuildable = trace.entityNum; + else + cg.crosshairBuildable = -1; + + return; + } + team = cgs.clientinfo[ trace.entityNum ].team; if( cg.snap->ps.persistant[ PERS_SPECSTATE ] == SPECTATOR_NOT ) diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 97606f10..9e1e9e7b 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1030,7 +1030,8 @@ typedef struct // kill timers for carnage reward int lastKillTime; - // crosshair client ID + // targeted entity + int crosshairBuildable; int crosshairClientNum; int crosshairClientTime; |