summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_ents.c16
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_misc.c4
-rw-r--r--src/game/g_spawn.c4
4 files changed, 15 insertions, 11 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 6d1dac68..95d55304 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -634,23 +634,24 @@ static void CG_TorchLight( centity_t *cent )
/*
=========================
-CG_LensFlare
+CG_LightFlare
=========================
*/
-static void CG_LensFlare( centity_t *cent )
+static void CG_LightFlare( centity_t *cent )
{
refEntity_t flare;
entityState_t *es;
vec3_t forward, delta;
float len;
trace_t tr;
+ float maxAngle;
es = &cent->currentState;
memset( &flare, 0, sizeof( flare ) );
//bunch of geometry
- AngleVectors( cent->lerpAngles, forward, NULL, NULL );
+ AngleVectors( es->angles, forward, NULL, NULL );
VectorCopy( cent->lerpOrigin, flare.origin );
VectorSubtract( flare.origin, cg.refdef.vieworg, delta );
len = VectorLength( delta );
@@ -665,8 +666,11 @@ static void CG_LensFlare( centity_t *cent )
//can only see the flare when in front of it
flare.radius = len / es->origin2[ 0 ];
- flare.radius *= DotProduct( delta, forward );
+ maxAngle = es->origin2[ 1 ];
+ if( maxAngle > 0.0f )
+ flare.radius *= 1.0f - ( 180.0f - RAD2DEG( acos( DotProduct( delta, forward ) ) ) ) / maxAngle;
+
//if can't see the centre do not draw
CG_Trace( &tr, flare.origin, NULL, NULL, cg.refdef.vieworg, 0, MASK_SHOT );
if( tr.fraction < 1.0f )
@@ -859,8 +863,8 @@ static void CG_AddCEntity( centity_t *cent ) {
case ET_ANIMMAPOBJ:
CG_animMapObj( cent );
break;
- case ET_LENSFLARE:
- CG_LensFlare( cent );
+ case ET_LIGHTFLARE:
+ CG_LightFlare( cent );
break;
}
}
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index cce117f8..a9f66292 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -1145,7 +1145,7 @@ typedef enum {
ET_CORPSE,
ET_SPRITER,
ET_ANIMMAPOBJ,
- ET_LENSFLARE,
+ ET_LIGHTFLARE,
ET_EVENTS // any of the EV_* events can be added freestanding
// by setting eType to ET_EVENTS + eventNum
diff --git a/src/game/g_misc.c b/src/game/g_misc.c
index 77960646..5698b845 100644
--- a/src/game/g_misc.c
+++ b/src/game/g_misc.c
@@ -450,9 +450,9 @@ void SP_misc_anim_model( gentity_t *self )
}
//TA: spawn function for lens flares
-void SP_misc_lens_flare( gentity_t *self )
+void SP_misc_light_flare( gentity_t *self )
{
- self->s.eType = ET_LENSFLARE;
+ self->s.eType = ET_LIGHTFLARE;
self->s.modelindex = G_ShaderIndex( self->targetShaderName );
VectorCopy( self->pos2, self->s.origin2 );
diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c
index 0ab52703..f0cb7178 100644
--- a/src/game/g_spawn.c
+++ b/src/game/g_spawn.c
@@ -204,7 +204,7 @@ void SP_team_CTF_bluespawn( gentity_t *ent );
//TA:
void SP_misc_spriter( gentity_t *ent );
void SP_misc_anim_model( gentity_t *ent );
-void SP_misc_lens_flare( gentity_t *ent );
+void SP_misc_light_flare( gentity_t *ent );
spawn_t spawns[] = {
// info entities don't do anything at all, but provide positional
@@ -279,7 +279,7 @@ spawn_t spawns[] = {
{"misc_spriter", SP_misc_spriter},
{"misc_anim_model", SP_misc_anim_model},
- {"misc_lens_flare", SP_misc_lens_flare},
+ {"misc_light_flare", SP_misc_light_flare},
{0, 0}
};