mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
changed pickup animation speed for demos according to demospeed (fixes issue 72)
This commit is contained in:
parent
4e608965ef
commit
5faec7c80d
|
@ -1,4 +1,5 @@
|
|||
#include <engine/graphics.h>
|
||||
#include <engine/demo.h>
|
||||
#include <game/generated/protocol.h>
|
||||
#include <game/generated/client_data.h>
|
||||
|
||||
|
@ -111,8 +112,21 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
Graphics()->QuadsSetRotation(Angle);
|
||||
|
||||
float Offset = Pos.y/32.0f + Pos.x/32.0f;
|
||||
Pos.x += cosf(Client()->LocalTime()*2.0f+Offset)*2.5f;
|
||||
Pos.y += sinf(Client()->LocalTime()*2.0f+Offset)*2.5f;
|
||||
if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Pos.x += cosf(Client()->LocalTime()*2.0f+Offset)*2.5f;
|
||||
Pos.y += sinf(Client()->LocalTime()*2.0f+Offset)*2.5f;
|
||||
}
|
||||
RenderTools()->DrawSprite(Pos.x, Pos.y, Size);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue