Merge pull request #8170 from Robyt3/Gameclient-Render-Checks

Improve performance when rendering menus
This commit is contained in:
Dennis Felsing 2024-04-01 03:58:07 +00:00 committed by GitHub
commit 9122080514
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 45 additions and 0 deletions

View file

@ -1166,6 +1166,9 @@ void CChat::OnPrepareLines(float y)
void CChat::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
// send pending chat messages
if(m_PendingChatCounter > 0 && m_LastChatSend + time_freq() < time())
{

View file

@ -360,6 +360,9 @@ int CControls::SnapInput(int *pData)
void CControls::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(g_Config.m_ClAutoswitchWeaponsOutOfAmmo && !GameClient()->m_GameInfo.m_UnlimitedAmmo && m_pClient->m_Snap.m_pLocalCharacter)
{
// Keep track of ammo count, we know weapon ammo only when we switch to that weapon, this is tracked on server and protocol does not track that

View file

@ -49,6 +49,9 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir, float Alpha)
void CDamageInd::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpriteStars[0]);
static float s_LastLocalTime = LocalTime();
for(int i = 0; i < m_NumItems;)

View file

@ -261,6 +261,9 @@ void CDebugHud::RenderHint()
void CDebugHud::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
RenderTuning();
RenderNetCorrections();
RenderHint();

View file

@ -60,6 +60,9 @@ bool CEmoticon::OnCursorMove(float x, float y, IInput::ECursorType CursorType)
void CEmoticon::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!m_Active)
{
if(m_WasActive && m_SelectedEmote != -1)

View file

@ -196,6 +196,9 @@ inline bool CFreezeBars::IsPlayerInfoAvailable(int ClientId) const
void CFreezeBars::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!g_Config.m_ClShowFreezeBars)
{
return;

View file

@ -311,6 +311,9 @@ void CGhost::OnNewPredictedSnapshot()
void CGhost::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
// Play the ghost
if(!m_Rendering || !g_Config.m_ClRaceShowGhost)
return;

View file

@ -1397,6 +1397,9 @@ void CHud::RenderLocalTime(float x)
void CHud::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!m_pClient->m_Snap.m_pGameInfoObj)
return;

View file

@ -420,6 +420,9 @@ void CInfoMessages::RenderFinishMsg(const CInfoMsg &InfoMsg, float x, float y)
void CInfoMessages::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
const float Height = 1.5f * 400.0f * 3.0f;
const float Width = Height * Graphics()->ScreenAspect();

View file

@ -43,6 +43,9 @@ void CMotd::OnWindowResize()
void CMotd::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!IsActive())
return;

View file

@ -289,6 +289,9 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
void CNamePlates::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
int ShowDirection = g_Config.m_ClShowDirection;
#if defined(CONF_VIDEORECORDER)
if(IVideo::Current())

View file

@ -754,6 +754,9 @@ inline bool CPlayers::IsPlayerInfoAvailable(int ClientId) const
void CPlayers::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
CTeeRenderInfo aRenderInfo[MAX_CLIENTS];
// update RenderInfo for ninja

View file

@ -568,6 +568,9 @@ void CScoreboard::RenderRecordingNotification(float x)
void CScoreboard::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!Active())
return;

View file

@ -194,6 +194,9 @@ void CSpectator::OnRelease()
void CSpectator::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if(!GameClient()->m_MultiViewActivated && m_MultiViewActivateDelay != 0.0f)
{
if(m_MultiViewActivateDelay <= Client()->LocalTime())

View file

@ -122,6 +122,9 @@ void CStatboard::OnMessage(int MsgType, void *pRawMsg)
void CStatboard::OnRender()
{
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return;
if((g_Config.m_ClAutoStatboardScreenshot || g_Config.m_ClAutoCSV) && Client()->State() != IClient::STATE_DEMOPLAYBACK)
{
if(m_ScreenshotTime < 0 && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER)