mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #8170 from Robyt3/Gameclient-Render-Checks
Improve performance when rendering menus
This commit is contained in:
commit
9122080514
|
@ -1166,6 +1166,9 @@ void CChat::OnPrepareLines(float y)
|
||||||
|
|
||||||
void CChat::OnRender()
|
void CChat::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
// send pending chat messages
|
// send pending chat messages
|
||||||
if(m_PendingChatCounter > 0 && m_LastChatSend + time_freq() < time())
|
if(m_PendingChatCounter > 0 && m_LastChatSend + time_freq() < time())
|
||||||
{
|
{
|
||||||
|
|
|
@ -360,6 +360,9 @@ int CControls::SnapInput(int *pData)
|
||||||
|
|
||||||
void CControls::OnRender()
|
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)
|
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
|
// 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
|
||||||
|
|
|
@ -49,6 +49,9 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir, float Alpha)
|
||||||
|
|
||||||
void CDamageInd::OnRender()
|
void CDamageInd::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpriteStars[0]);
|
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpriteStars[0]);
|
||||||
static float s_LastLocalTime = LocalTime();
|
static float s_LastLocalTime = LocalTime();
|
||||||
for(int i = 0; i < m_NumItems;)
|
for(int i = 0; i < m_NumItems;)
|
||||||
|
|
|
@ -261,6 +261,9 @@ void CDebugHud::RenderHint()
|
||||||
|
|
||||||
void CDebugHud::OnRender()
|
void CDebugHud::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
RenderTuning();
|
RenderTuning();
|
||||||
RenderNetCorrections();
|
RenderNetCorrections();
|
||||||
RenderHint();
|
RenderHint();
|
||||||
|
|
|
@ -60,6 +60,9 @@ bool CEmoticon::OnCursorMove(float x, float y, IInput::ECursorType CursorType)
|
||||||
|
|
||||||
void CEmoticon::OnRender()
|
void CEmoticon::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!m_Active)
|
if(!m_Active)
|
||||||
{
|
{
|
||||||
if(m_WasActive && m_SelectedEmote != -1)
|
if(m_WasActive && m_SelectedEmote != -1)
|
||||||
|
|
|
@ -196,6 +196,9 @@ inline bool CFreezeBars::IsPlayerInfoAvailable(int ClientId) const
|
||||||
|
|
||||||
void CFreezeBars::OnRender()
|
void CFreezeBars::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!g_Config.m_ClShowFreezeBars)
|
if(!g_Config.m_ClShowFreezeBars)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -311,6 +311,9 @@ void CGhost::OnNewPredictedSnapshot()
|
||||||
|
|
||||||
void CGhost::OnRender()
|
void CGhost::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
// Play the ghost
|
// Play the ghost
|
||||||
if(!m_Rendering || !g_Config.m_ClRaceShowGhost)
|
if(!m_Rendering || !g_Config.m_ClRaceShowGhost)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1397,6 +1397,9 @@ void CHud::RenderLocalTime(float x)
|
||||||
|
|
||||||
void CHud::OnRender()
|
void CHud::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!m_pClient->m_Snap.m_pGameInfoObj)
|
if(!m_pClient->m_Snap.m_pGameInfoObj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -420,6 +420,9 @@ void CInfoMessages::RenderFinishMsg(const CInfoMsg &InfoMsg, float x, float y)
|
||||||
|
|
||||||
void CInfoMessages::OnRender()
|
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 Height = 1.5f * 400.0f * 3.0f;
|
||||||
const float Width = Height * Graphics()->ScreenAspect();
|
const float Width = Height * Graphics()->ScreenAspect();
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ void CMotd::OnWindowResize()
|
||||||
|
|
||||||
void CMotd::OnRender()
|
void CMotd::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!IsActive())
|
if(!IsActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,9 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
||||||
|
|
||||||
void CNamePlates::OnRender()
|
void CNamePlates::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
int ShowDirection = g_Config.m_ClShowDirection;
|
int ShowDirection = g_Config.m_ClShowDirection;
|
||||||
#if defined(CONF_VIDEORECORDER)
|
#if defined(CONF_VIDEORECORDER)
|
||||||
if(IVideo::Current())
|
if(IVideo::Current())
|
||||||
|
|
|
@ -754,6 +754,9 @@ inline bool CPlayers::IsPlayerInfoAvailable(int ClientId) const
|
||||||
|
|
||||||
void CPlayers::OnRender()
|
void CPlayers::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
CTeeRenderInfo aRenderInfo[MAX_CLIENTS];
|
CTeeRenderInfo aRenderInfo[MAX_CLIENTS];
|
||||||
|
|
||||||
// update RenderInfo for ninja
|
// update RenderInfo for ninja
|
||||||
|
|
|
@ -568,6 +568,9 @@ void CScoreboard::RenderRecordingNotification(float x)
|
||||||
|
|
||||||
void CScoreboard::OnRender()
|
void CScoreboard::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!Active())
|
if(!Active())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,9 @@ void CSpectator::OnRelease()
|
||||||
|
|
||||||
void CSpectator::OnRender()
|
void CSpectator::OnRender()
|
||||||
{
|
{
|
||||||
|
if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!GameClient()->m_MultiViewActivated && m_MultiViewActivateDelay != 0.0f)
|
if(!GameClient()->m_MultiViewActivated && m_MultiViewActivateDelay != 0.0f)
|
||||||
{
|
{
|
||||||
if(m_MultiViewActivateDelay <= Client()->LocalTime())
|
if(m_MultiViewActivateDelay <= Client()->LocalTime())
|
||||||
|
|
|
@ -122,6 +122,9 @@ void CStatboard::OnMessage(int MsgType, void *pRawMsg)
|
||||||
|
|
||||||
void CStatboard::OnRender()
|
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((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)
|
if(m_ScreenshotTime < 0 && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER)
|
||||||
|
|
Loading…
Reference in a new issue