@ -246,7 +246,7 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
@@ -246,7 +246,7 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
if ( FBitSet ( clent - > curstate . effects , EF_NODRAW ) )
return false ; // done
if ( ! R_ModelOpaque ( clent - > curstate . rendermode ) & & gEngfuncs . CL_FxBlend ( clent ) < = 0 )
if ( ! R_ModelOpaque ( clent - > curstate . rendermode ) & & CL_FxBlend ( clent ) < = 0 )
return true ; // invisible
if ( type = = ET_FRAGMENTED )
@ -875,7 +875,7 @@ void R_DrawEntitiesOnList( void )
@@ -875,7 +875,7 @@ void R_DrawEntitiesOnList( void )
// handle studiomodels with custom rendermodes on texture
if ( RI . currententity - > curstate . rendermode ! = kRenderNormal )
tr . blend = gEngfuncs . CL_FxBlend ( RI . currententity ) / 255.0f ;
tr . blend = CL_FxBlend ( RI . currententity ) / 255.0f ;
else tr . blend = 1.0f ; // draw as solid but sorted by distance
if ( tr . blend < = 0.0f ) continue ;
@ -1173,3 +1173,123 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
@@ -1173,3 +1173,123 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
RI . viewleaf = NULL ; // force markleafs next frame
}
/*
= = = = = = = = = = = = = = =
CL_FxBlend
= = = = = = = = = = = = = = =
*/
int CL_FxBlend ( cl_entity_t * e )
{
int blend = 0 ;
float offset , dist ;
vec3_t tmp ;
offset = ( ( int ) e - > index ) * 363.0f ; // Use ent index to de-sync these fx
switch ( e - > curstate . renderfx )
{
case kRenderFxPulseSlowWide :
blend = e - > curstate . renderamt + 0x40 * sin ( gpGlobals - > time * 2 + offset ) ;
break ;
case kRenderFxPulseFastWide :
blend = e - > curstate . renderamt + 0x40 * sin ( gpGlobals - > time * 8 + offset ) ;
break ;
case kRenderFxPulseSlow :
blend = e - > curstate . renderamt + 0x10 * sin ( gpGlobals - > time * 2 + offset ) ;
break ;
case kRenderFxPulseFast :
blend = e - > curstate . renderamt + 0x10 * sin ( gpGlobals - > time * 8 + offset ) ;
break ;
case kRenderFxFadeSlow :
if ( RP_NORMALPASS ( ) )
{
if ( e - > curstate . renderamt > 0 )
e - > curstate . renderamt - = 1 ;
else e - > curstate . renderamt = 0 ;
}
blend = e - > curstate . renderamt ;
break ;
case kRenderFxFadeFast :
if ( RP_NORMALPASS ( ) )
{
if ( e - > curstate . renderamt > 3 )
e - > curstate . renderamt - = 4 ;
else e - > curstate . renderamt = 0 ;
}
blend = e - > curstate . renderamt ;
break ;
case kRenderFxSolidSlow :
if ( RP_NORMALPASS ( ) )
{
if ( e - > curstate . renderamt < 255 )
e - > curstate . renderamt + = 1 ;
else e - > curstate . renderamt = 255 ;
}
blend = e - > curstate . renderamt ;
break ;
case kRenderFxSolidFast :
if ( RP_NORMALPASS ( ) )
{
if ( e - > curstate . renderamt < 252 )
e - > curstate . renderamt + = 4 ;
else e - > curstate . renderamt = 255 ;
}
blend = e - > curstate . renderamt ;
break ;
case kRenderFxStrobeSlow :
blend = 20 * sin ( gpGlobals - > time * 4 + offset ) ;
if ( blend < 0 ) blend = 0 ;
else blend = e - > curstate . renderamt ;
break ;
case kRenderFxStrobeFast :
blend = 20 * sin ( gpGlobals - > time * 16 + offset ) ;
if ( blend < 0 ) blend = 0 ;
else blend = e - > curstate . renderamt ;
break ;
case kRenderFxStrobeFaster :
blend = 20 * sin ( gpGlobals - > time * 36 + offset ) ;
if ( blend < 0 ) blend = 0 ;
else blend = e - > curstate . renderamt ;
break ;
case kRenderFxFlickerSlow :
blend = 20 * ( sin ( gpGlobals - > time * 2 ) + sin ( gpGlobals - > time * 17 + offset ) ) ;
if ( blend < 0 ) blend = 0 ;
else blend = e - > curstate . renderamt ;
break ;
case kRenderFxFlickerFast :
blend = 20 * ( sin ( gpGlobals - > time * 16 ) + sin ( gpGlobals - > time * 23 + offset ) ) ;
if ( blend < 0 ) blend = 0 ;
else blend = e - > curstate . renderamt ;
break ;
case kRenderFxHologram :
case kRenderFxDistort :
VectorCopy ( e - > origin , tmp ) ;
VectorSubtract ( tmp , RI . vieworg , tmp ) ;
dist = DotProduct ( tmp , RI . vforward ) ;
// turn off distance fade
if ( e - > curstate . renderfx = = kRenderFxDistort )
dist = 1 ;
if ( dist < = 0 )
{
blend = 0 ;
}
else
{
e - > curstate . renderamt = 180 ;
if ( dist < = 100 ) blend = e - > curstate . renderamt ;
else blend = ( int ) ( ( 1.0f - ( dist - 100 ) * ( 1.0f / 400.0f ) ) * e - > curstate . renderamt ) ;
blend + = gEngfuncs . COM_RandomLong ( - 32 , 31 ) ;
}
break ;
default :
blend = e - > curstate . renderamt ;
break ;
}
blend = bound ( 0 , blend , 255 ) ;
return blend ;
}