From 9251796c3a8e3f31f9aa52ef84b9e0ce475d2f9b Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 9 Jan 2012 23:43:53 +0100 Subject: fixed rendering on pause/specific speed for damage indicators and muzzle in the demo player --- src/game/client/components/damageind.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/game/client/components/damageind.cpp') diff --git a/src/game/client/components/damageind.cpp b/src/game/client/components/damageind.cpp index 9be6722a..e2da21e1 100644 --- a/src/game/client/components/damageind.cpp +++ b/src/game/client/components/damageind.cpp @@ -1,5 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +#include #include #include #include @@ -46,11 +47,20 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir) void CDamageInd::OnRender() { - Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id); Graphics()->QuadsBegin(); + static float s_LastLocalTime = Client()->LocalTime(); for(int i = 0; i < m_NumItems;) { + if(Client()->State() == IClient::STATE_DEMOPLAYBACK) + { + const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); + if(pInfo->m_Paused) + m_aItems[i].m_StartTime += Client()->LocalTime()-s_LastLocalTime; + else + m_aItems[i].m_StartTime += (Client()->LocalTime()-s_LastLocalTime)*(1.0f-pInfo->m_Speed); + } + float Life = 0.75f - (Client()->LocalTime() - m_aItems[i].m_StartTime); if(Life < 0.0f) DestroyI(&m_aItems[i]); @@ -64,6 +74,7 @@ void CDamageInd::OnRender() i++; } } + s_LastLocalTime = Client()->LocalTime(); Graphics()->QuadsEnd(); } -- cgit 1.4.1