mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Only predict pickup if affected by movers
This commit is contained in:
parent
0d0f22ae8c
commit
769970b30b
|
@ -320,12 +320,15 @@ void CItems::OnRender()
|
|||
}
|
||||
for(auto *pPickup = (CPickup *)GameClient()->m_PredictedWorld.FindFirst(CGameWorld::ENTTYPE_PICKUP); pPickup; pPickup = (CPickup *)pPickup->NextEntity())
|
||||
{
|
||||
if(auto *pPrev = (CPickup *)GameClient()->m_PrevPredictedWorld.GetEntity(pPickup->ID(), CGameWorld::ENTTYPE_PICKUP))
|
||||
if(pPickup->InDDNetTile())
|
||||
{
|
||||
CNetObj_Pickup Data, Prev;
|
||||
pPickup->FillInfo(&Data);
|
||||
pPrev->FillInfo(&Prev);
|
||||
RenderPickup(&Prev, &Data, true);
|
||||
if(auto *pPrev = (CPickup *)GameClient()->m_PrevPredictedWorld.GetEntity(pPickup->ID(), CGameWorld::ENTTYPE_PICKUP))
|
||||
{
|
||||
CNetObj_Pickup Data, Prev;
|
||||
pPickup->FillInfo(&Data);
|
||||
pPrev->FillInfo(&Prev);
|
||||
RenderPickup(&Prev, &Data, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +372,11 @@ void CItems::OnRender()
|
|||
else if(Item.m_Type == NETOBJTYPE_PICKUP)
|
||||
{
|
||||
if(UsePredicted)
|
||||
continue;
|
||||
{
|
||||
auto *pPickup = (CPickup *)GameClient()->m_GameWorld.FindMatch(Item.m_ID, Item.m_Type, pData);
|
||||
if(pPickup && pPickup->InDDNetTile())
|
||||
continue;
|
||||
}
|
||||
const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID);
|
||||
if(pPrev)
|
||||
RenderPickup((const CNetObj_Pickup *)pPrev, (const CNetObj_Pickup *)pData);
|
||||
|
|
|
@ -77,8 +77,13 @@ void CPickup::Move()
|
|||
int index = Collision()->IsMover(m_Pos.x, m_Pos.y, &Flags);
|
||||
if(index)
|
||||
{
|
||||
m_IsCoreActive = true;
|
||||
m_Core = Collision()->CpSpeed(index, Flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IsCoreActive = false;
|
||||
}
|
||||
m_Pos += m_Core;
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +96,7 @@ CPickup::CPickup(CGameWorld *pGameWorld, int ID, CNetObj_Pickup *pPickup) :
|
|||
m_Type = pPickup->m_Type;
|
||||
m_Subtype = pPickup->m_Subtype;
|
||||
m_Core = vec2(0.f, 0.f);
|
||||
m_IsCoreActive = false;
|
||||
m_ID = ID;
|
||||
m_Layer = LAYER_GAME;
|
||||
m_Number = 0;
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
CPickup(CGameWorld *pGameWorld, int ID, CNetObj_Pickup *pPickup);
|
||||
void FillInfo(CNetObj_Pickup *pPickup);
|
||||
bool Match(CPickup *pPickup);
|
||||
bool InDDNetTile() { return m_IsCoreActive; }
|
||||
|
||||
private:
|
||||
int m_Type;
|
||||
|
@ -24,6 +25,7 @@ private:
|
|||
|
||||
void Move();
|
||||
vec2 m_Core;
|
||||
bool m_IsCoreActive;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue