summaryrefslogtreecommitdiff
path: root/src/cgame/cg_ents.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-12-20 00:53:13 +0000
committerTim Angus <tim@ngus.net>2005-12-20 00:53:13 +0000
commit611eb5ee8a55d5aa473c48f8f9436a01e3f0cdb7 (patch)
treee2c52d2d0c43e5343df017c7578fb99275a8bfed /src/cgame/cg_ents.c
parent65b823bf367034c204d370a6a73965a196072153 (diff)
* New collision type, for improved light flares
Diffstat (limited to 'src/cgame/cg_ents.c')
-rw-r--r--src/cgame/cg_ents.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index f2f593cf..0c279a31 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -670,10 +670,10 @@ static void CG_LightFlare( centity_t *cent )
float radiusMod = 1.0f - ( 180.0f - RAD2DEG(
acos( DotProduct( delta, forward ) ) ) ) / maxAngle;
- if( es->eFlags & EF_NODRAW )
- flare.radius *= radiusMod;
- else if( radiusMod < 0.0f )
- flare.radius = 0.0f;
+ if( radiusMod < 0.0f )
+ radiusMod = 0.0f;
+
+ flare.radius *= radiusMod;
}
if( flare.radius < 0.0f )
@@ -684,34 +684,14 @@ static void CG_LightFlare( centity_t *cent )
if( cg_lightFlare.integer == FLARE_REALFADE )
{
- //draw "correct" albeit inefficient flares
- srLocal = cent->lfs.lastSrcRadius;
-
- //flare radius is likely to be the same as last frame so start with it
- do
- {
- srLocal += RADIUSSTEP;
- SETBOUNDS( mins, maxs, srLocal );
- CG_Trace( &tr, start, mins, maxs, end,
- entityNum, MASK_SHOT );
-
- } while( ( tr.fraction == 1.0f && !tr.startsolid ) && ( srLocal < srcRadius ) );
-
- srLocal -= RADIUSSTEP;
+ //"correct" flares
+ CG_BiSphereTrace( &tr, cg.refdef.vieworg, end,
+ 1.0f, srcRadius, entityNum, MASK_SHOT );
- //shink the flare until there is a los
- do
- {
- SETBOUNDS( mins, maxs, srLocal );
- CG_Trace( &tr, start, mins, maxs, end,
- entityNum, MASK_SHOT );
-
- srLocal -= RADIUSSTEP;
- } while( ( tr.fraction < 1.0f || tr.startsolid ) && ( srLocal > 0.0f ) );
-
- ratio = srLocal / srcRadius;
-
- cent->lfs.lastSrcRadius = srLocal;
+ if( tr.fraction < 1.0f )
+ ratio = tr.lateralFraction;
+ else
+ ratio = 1.0f;
}
else if( cg_lightFlare.integer == FLARE_TIMEFADE )
{