From 17f13b9f97d74c1a48b245dd703573119ab52ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 11 Aug 2024 18:18:14 +0200 Subject: [PATCH] Print chat/broadcast times in `demo_extract_chat` tool This makes it easier to find the times of specific chat messages and broadcasts in demos. --- src/tools/demo_extract_chat.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tools/demo_extract_chat.cpp b/src/tools/demo_extract_chat.cpp index bd9777a06..323b139c9 100644 --- a/src/tools/demo_extract_chat.cpp +++ b/src/tools/demo_extract_chat.cpp @@ -151,6 +151,10 @@ public: if(!pRawMsg) return; + const IDemoPlayer::CInfo &Info = m_pDemoPlayer->Info()->m_Info; + char aTime[20]; + str_time((int64_t)(Info.m_CurrentTick - Info.m_FirstTick) / SERVER_TICK_SPEED * 100, TIME_HOURS, aTime, sizeof(aTime)); + if(Msg == NETMSGTYPE_SV_CHAT) { CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg; @@ -162,16 +166,16 @@ public: if(pMsg->m_ClientId < 0) { - printf("%s: *** %s\n", Prefix, pMsg->m_pMessage); + printf("[%s] %s: *** %s\n", aTime, Prefix, pMsg->m_pMessage); return; } if(pMsg->m_Team == TEAM_WHISPER_SEND) - printf("%s: -> %s: %s\n", Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); + printf("[%s] %s: -> %s: %s\n", aTime, Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); else if(pMsg->m_Team == TEAM_WHISPER_RECV) - printf("%s: <- %s: %s\n", Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); + printf("[%s] %s: <- %s: %s\n", aTime, Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); else - printf("%s: %s: %s\n", Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); + printf("[%s] %s: %s: %s\n", aTime, Prefix, m_pClientSnapshotHandler->m_aClients[pMsg->m_ClientId].m_aName, pMsg->m_pMessage); } else if(Msg == NETMSGTYPE_SV_BROADCAST) { @@ -181,7 +185,7 @@ public: { if(aBroadcast[0] != '\0') { - printf("broadcast: %s\n", aBroadcast); + printf("[%s] broadcast: %s\n", aTime, aBroadcast); } } }