From 314cda05c7cda9afb05b4b9176dc94dcc16ac760 Mon Sep 17 00:00:00 2001 From: SushiTee Date: Tue, 19 Oct 2010 13:37:36 +0200 Subject: changed demo animations according to demo speed and added some demo speeds. (fixes #206) --- src/game/client/components/items.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/game/client/components/items.cpp') diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index b4d696f7..a039717e 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -58,7 +58,22 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemId) { m_pClient->m_pEffects->SmokeTrail(Pos, Vel*-1); m_pClient->m_pFlow->Add(Pos, Vel*1000*Client()->FrameTime(), 10.0f); - Graphics()->QuadsSetRotation(Client()->LocalTime()*pi*2*2 + ItemId); + + if(Client()->State() == IClient::STATE_DEMOPLAYBACK) + { + const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); + static float Time = 0; + static float LastLocalTime = Client()->LocalTime(); + + if(!pInfo->m_Paused) + Time += (Client()->LocalTime()-LastLocalTime)*pInfo->m_Speed; + + Graphics()->QuadsSetRotation(Time*pi*2*2 + ItemId); + + LastLocalTime = Client()->LocalTime(); + } + else + Graphics()->QuadsSetRotation(Client()->LocalTime()*pi*2*2 + ItemId); } else { @@ -115,12 +130,16 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu if(Client()->State() == IClient::STATE_DEMOPLAYBACK) { const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); + static float Time = 0; + static float LastLocalTime = Client()->LocalTime(); if(!pInfo->m_Paused) - { - Pos.x += cosf(Client()->LocalTime()*pInfo->m_Speed*2.0f+Offset)*2.5f; - Pos.y += sinf(Client()->LocalTime()*pInfo->m_Speed*2.0f+Offset)*2.5f; - } + Time += (Client()->LocalTime()-LastLocalTime)*pInfo->m_Speed; + + Pos.x += cosf(Time*2.0f+Offset)*2.5f; + Pos.y += sinf(Time*2.0f+Offset)*2.5f; + + LastLocalTime = Client()->LocalTime(); } else { -- cgit 1.4.1