UTIL_ScreenFadeAll

From Valve Developer Community
Jump to: navigation, search

UTIL_ScreenFadeAll is a UTIL provided to fade all players screens to a specified color.

Note.pngNote:This function only gets called in two places. See UTIL_ScreenFade instead.

Usage

//-----------------------------------------------------------------------------
// Purpose: Fade all player's screens to a specified color.
// Input  : &color  - Color to fade to
// Input  : fadeTime - Time it takes to fade
// Input  : fadeHold - Time the fade holds for
// Input  : flags - Fade in, Fade Out, Fade_Modulate (don't blend), Fade_StayOut, Fade_Purge (Replaces others)
// Output : 
//-----------------------------------------------------------------------------
void UTIL_ScreenFadeAll( const color32 &color, float fadeTime, float fadeHold, int flags )
{
	int			i;
	ScreenFade_t	fade;


	UTIL_ScreenFadeBuild( fade, color, fadeTime, fadeHold, flags );

	for ( i = 1; i <= gpGlobals->maxClients; i++ )
	{
		CBaseEntity *pPlayer = UTIL_PlayerByIndex( i );
	
		UTIL_ScreenFadeWrite( fade, pPlayer );
	}
}

Fade Flags

#define FFADE_IN			0x0001		// Just here so we don't pass 0 into the function
#define FFADE_OUT			0x0002		// Fade out (not in)
#define FFADE_MODULATE			0x0004		// Modulate (don't blend)
#define FFADE_STAYOUT			0x0008		// ignores the duration, stays faded out until new ScreenFade message received
#define FFADE_PURGE			0x0010		// Purges all other fades, replacing them with this one

Examples

UTIL_ScreenFadeAll( m_clrRender, Duration(), HoldTime(), FFADE_OUT );
UTIL_ScreenFadeAll( m_clrRender, Duration(), HoldTime(), fadeFlags|FFADE_PURGE );