cl_dll/hud_redraw.cpp
// Redraw
// step through the local data,  placing the appropriate graphics & text as appropriate
// returns 1 if they've changed, 0 otherwise
Redraw
step through the local data,  placing the appropriate graphics & text as appropriate
returns 1 if they've changed, 0 otherwise
Redraw step through the local data placing the appropriate graphics & text as appropriate returns 1 if they ' ve changed 0 otherwise
bool CHud::Redraw(float flTime, bool intermission)
{
	cl_entity_s* view = gEngfuncs.GetViewModel();
	m_fOldTime = m_flTime; 
	m_flTime = flTime;
	m_flTimeDelta = (double)m_flTime - m_fOldTime;
	static float m_flShotTime = 0;
	if (m_flTimeDelta < 0)
		m_flTimeDelta = 0;
	if (view != nullptr && view->model != nullptr)
	{
		cl_animutils.DispatchAnimEvents(view, m_flTimeDelta);
	}
	else
	{
		g_viewinfo.m_iPrevSeq = -1;
	}
	if (gViewPort)
	{
		if (m_iIntermission && !intermission)
		{
			m_iIntermission = intermission;
			gViewPort->HideCommandMenu();
			gViewPort->HideScoreBoard();
			gViewPort->UpdateSpectatorPanel();
		}
		else if (!m_iIntermission && intermission)
		{
			m_iIntermission = intermission;
			gViewPort->HideCommandMenu();
			gViewPort->HideVGUIMenu();
			gViewPort->ShowScoreBoard();
			gViewPort->UpdateSpectatorPanel();
			if (CVAR_GET_FLOAT("hud_takesshots") != 0)
				m_flShotTime = flTime + 1.0; 
		}
	}
	if (0 != m_flShotTime && m_flShotTime < flTime)
	{
		gEngfuncs.pfnClientCmd("snapshot\n");
		m_flShotTime = 0;
	}
	m_iIntermission = intermission;
	if (0 != m_pCvarDraw->value)
	{
		HUDLIST* pList = m_pHudList;
		while (pList)
		{
			if (!intermission)
			{
				if ((pList->p->m_iFlags & HUD_ACTIVE) != 0 && (m_iHideHUDDisplay & HIDEHUD_ALL) == 0)
					pList->p->Draw(flTime);
			}
			else
			{ 
				if ((pList->p->m_iFlags & HUD_INTERMISSION) != 0)
					pList->p->Draw(flTime);
			}
			pList = pList->pNext;
		}
	}
	if (0 != m_iLogo)
	{
		int x, y, i;
		if (m_hsprLogo == 0)
			m_hsprLogo = LoadSprite("sprites/%d_logo.spr");
		SPR_Set(m_hsprLogo, 250, 250, 250);
		x = SPR_Width(m_hsprLogo, 0);
		x = ScreenWidth - x;
		y = SPR_Height(m_hsprLogo, 0) / 2;
		int iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES;
		i = grgLogoFrame[iFrame] - 1;
		SPR_DrawAdditive(i, x, y, NULL);
	}
	/*
	if ( g_iVisibleMouse )
	{
		void IN_GetMousePos( int *mx, int *my );
		int mx, my;
		IN_GetMousePos( &mx, &my );
		if (m_hsprCursor == 0)
		{
			char sz[256];
			sprintf( sz, "sprites/cursor.spr" );
			m_hsprCursor = SPR_Load( sz );
		}
		SPR_Set(m_hsprCursor, 250, 250, 250 );
		SPR_DrawAdditive( 0, mx, my, NULL );
	}
	*/
	return true;
}
bool CHud :: Redraw ( float flTime , bool intermission ) { cl_entity_s * view = gEngfuncs . GetViewModel ( ) ; m_fOldTime = m_flTime ; m_flTime = flTime ; m_flTimeDelta = ( double ) m_flTime - m_fOldTime ; static float m_flShotTime = 0 ; if ( m_flTimeDelta < 0 ) m_flTimeDelta = 0 ; if ( view != nullptr && view -> model != nullptr ) { cl_animutils . DispatchAnimEvents ( view , m_flTimeDelta ) ; } else { g_viewinfo . m_iPrevSeq = -1 ; } if ( gViewPort ) { if ( m_iIntermission && ! intermission ) { m_iIntermission = intermission ; gViewPort -> HideCommandMenu ( ) ; gViewPort -> HideScoreBoard ( ) ; gViewPort -> UpdateSpectatorPanel ( ) ; } else if ( ! m_iIntermission && intermission ) { m_iIntermission = intermission ; gViewPort -> HideCommandMenu ( ) ; gViewPort -> HideVGUIMenu ( ) ; gViewPort -> ShowScoreBoard ( ) ; gViewPort -> UpdateSpectatorPanel ( ) ; if ( CVAR_GET_FLOAT ( " " ) != 0 ) m_flShotTime = flTime + 1.0 ; } } if ( 0 != m_flShotTime && m_flShotTime < flTime ) { gEngfuncs . pfnClientCmd ( " \n " ) ; m_flShotTime = 0 ; } m_iIntermission = intermission ; if ( 0 != m_pCvarDraw -> value ) { HUDLIST * pList = m_pHudList ; while ( pList ) { if ( ! intermission ) { if ( ( pList -> p -> m_iFlags & HUD_ACTIVE ) != 0 && ( m_iHideHUDDisplay & HIDEHUD_ALL ) == 0 ) pList -> p -> Draw ( flTime ) ; } else { if ( ( pList -> p -> m_iFlags & HUD_INTERMISSION ) != 0 ) pList -> p -> Draw ( flTime ) ; } pList = pList -> pNext ; } } if ( 0 != m_iLogo ) { int x , y , i ; if ( m_hsprLogo == 0 ) m_hsprLogo = LoadSprite ( " " ) ; SPR_Set ( m_hsprLogo , 250 , 250 , 250 ) ; x = SPR_Width ( m_hsprLogo , 0 ) ; x = ScreenWidth - x ; y = SPR_Height ( m_hsprLogo , 0 ) / 2 ; int iFrame = ( int ) ( flTime * 20 ) % MAX_LOGO_FRAMES ; i = grgLogoFrame [ iFrame ] - 1 ; SPR_DrawAdditive ( i , x , y , NULL ) ; } return true ; }
Redraw
step through the local data,  placing the appropriate graphics & text as appropriate
returns 1 if they've changed, 0 otherwise
Redraw step through the local data placing the appropriate graphics & text as appropriate returns 1 if they ' ve changed 0 otherwise
// save time of previous redraw // Clock was reset, reset delta // Bring up the scoreboard during intermission // Have to do this here so the scoreboard goes away // Take a screenshot if the client's got the cvar set // Take a screenshot in a second // if no redrawing is necessary // return 0; // draw all registered HUD elements // it's an intermission,  so only draw hud elements that are set to draw during intermissions // are we in demo mode? do we need to draw the logo in the top corner? // Draw the logo at 20 fps /*
	if ( g_iVisibleMouse )
	{
		void IN_GetMousePos( int *mx, int *my );
		int mx, my;

		IN_GetMousePos( &mx, &my );
		
		if (m_hsprCursor == 0)
		{
			char sz[256];
			sprintf( sz, "sprites/cursor.spr" );
			m_hsprCursor = SPR_Load( sz );
		}

		SPR_Set(m_hsprCursor, 250, 250, 250 );
		
		// Draw the logo at 20 fps
		SPR_DrawAdditive( 0, mx, my, NULL );
	}
	*/