Suppress more events while skipping in demos:

- chat messages
- kill messages
- sounds
- stats
- air jump effects
This commit is contained in:
Robert Müller 2022-08-28 11:53:16 +02:00
parent b31fa557b7
commit b2fbfac4d1
5 changed files with 25 additions and 12 deletions

View file

@ -564,6 +564,9 @@ void CChat::DisableMode()
void CChat::OnMessage(int MsgType, void *pRawMsg)
{
if(m_pClient->m_SuppressEvents)
return;
if(MsgType == NETMSGTYPE_SV_CHAT)
{
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;

View file

@ -100,6 +100,9 @@ void CKillMessages::CreateKillmessageNamesIfNotCreated(CKillMsg &Kill)
void CKillMessages::OnMessage(int MsgType, void *pRawMsg)
{
if(m_pClient->m_SuppressEvents)
return;
if(MsgType == NETMSGTYPE_SV_KILLMSG)
{
CNetMsg_Sv_KillMsg *pMsg = (CNetMsg_Sv_KillMsg *)pRawMsg;

View file

@ -176,15 +176,15 @@ void CSounds::ClearQueue()
void CSounds::Enqueue(int Channel, int SetId)
{
// add sound to the queue
if(m_QueuePos < QUEUE_SIZE)
{
if(Channel == CHN_MUSIC || !g_Config.m_ClEditor)
{
m_aQueue[m_QueuePos].m_Channel = Channel;
m_aQueue[m_QueuePos++].m_SetId = SetId;
}
}
if(m_pClient->m_SuppressEvents)
return;
if(m_QueuePos >= QUEUE_SIZE)
return;
if(Channel != CHN_MUSIC && g_Config.m_ClEditor)
return;
m_aQueue[m_QueuePos].m_Channel = Channel;
m_aQueue[m_QueuePos++].m_SetId = SetId;
}
void CSounds::PlayAndRecord(int Channel, int SetId, float Vol, vec2 Pos)
@ -198,6 +198,8 @@ void CSounds::PlayAndRecord(int Channel, int SetId, float Vol, vec2 Pos)
void CSounds::Play(int Channel, int SetId, float Vol)
{
if(m_pClient->m_SuppressEvents)
return;
if(Channel == CHN_MUSIC && !g_Config.m_SndMusic)
return;
@ -214,6 +216,8 @@ void CSounds::Play(int Channel, int SetId, float Vol)
void CSounds::PlayAt(int Channel, int SetId, float Vol, vec2 Pos)
{
if(m_pClient->m_SuppressEvents)
return;
if(Channel == CHN_MUSIC && !g_Config.m_SndMusic)
return;

View file

@ -48,6 +48,9 @@ bool CStatboard::IsActive()
void CStatboard::OnMessage(int MsgType, void *pRawMsg)
{
if(m_pClient->m_SuppressEvents)
return;
if(MsgType == NETMSGTYPE_SV_KILLMSG)
{
CNetMsg_Sv_KillMsg *pMsg = (CNetMsg_Sv_KillMsg *)pRawMsg;

View file

@ -1843,10 +1843,10 @@ void CGameClient::OnPredict()
m_NewPredictedTick = true;
vec2 Pos = pLocalChar->Core()->m_Pos;
int Events = pLocalChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict)
if(g_Config.m_ClPredict && !m_SuppressEvents)
if(Events & COREEVENT_AIR_JUMP)
m_Effects.AirJump(Pos);
if(g_Config.m_SndGame)
if(g_Config.m_SndGame && !m_SuppressEvents)
{
if(Events & COREEVENT_GROUND_JUMP)
m_Sounds.PlayAndRecord(CSounds::CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, Pos);
@ -1863,7 +1863,7 @@ void CGameClient::OnPredict()
m_aLastNewPredictedTick[!Dummy] = Tick;
vec2 Pos = pDummyChar->Core()->m_Pos;
int Events = pDummyChar->Core()->m_TriggeredEvents;
if(g_Config.m_ClPredict)
if(g_Config.m_ClPredict && !m_SuppressEvents)
if(Events & COREEVENT_AIR_JUMP)
m_Effects.AirJump(Pos);
}