Fix antiping smoketrails

This commit is contained in:
trml 2020-05-01 16:29:06 +02:00
parent 47cafe6d6b
commit cda99668c7
3 changed files with 6 additions and 8 deletions

View file

@ -329,7 +329,7 @@ void CItems::OnRender()
&& (pProj->GetOwner() < 0 || !GameClient()->m_aClients[pProj->GetOwner()].m_IsPredictedLocal) // skip locally predicted projectiles
&& !Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID))
{
ReconstructSmokeTrail((const CNetObj_Projectile *)pData, Item.m_ID, pProj->m_DestroyTick, pProj->m_LifeSpan);
ReconstructSmokeTrail((const CNetObj_Projectile *)pData, Item.m_ID, pProj->m_DestroyTick);
}
pProj->m_LastRenderTick = Client()->GameTick(g_Config.m_ClDummy);
continue;
@ -442,7 +442,7 @@ void CItems::AddExtraProjectile(CNetObj_Projectile *pProj)
}
}
void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemID, int DestroyTick, int LifeSpan)
void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemID, int DestroyTick)
{
bool LocalPlayerInGame = false;
@ -495,7 +495,6 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
float T = Pt;
if(DestroyTick >= 0)
T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy))/(float)SERVER_TICK_SPEED);
T = minimum(T, LifeSpan/(float)SERVER_TICK_SPEED);
float MinTrailSpan = 0.4f * ((pCurrent->m_Type == WEAPON_GRENADE) ? 0.5f : 0.25f);
float Step = maximum(Client()->FrameTimeAvg(), (pCurrent->m_Type == WEAPON_GRENADE) ? 0.02f : 0.01f);

View file

@ -27,7 +27,7 @@ public:
void AddExtraProjectile(CNetObj_Projectile *pProj);
void ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemID, int DestroyTick, int LifeSpan);
void ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemID, int DestroyTick);
};
#endif

View file

@ -156,11 +156,10 @@ void CGameWorld::RemoveEntity(CEntity *pEnt)
m_Core.m_apCharacters[ID] = 0;
}
}
pEnt->m_pParent = 0;
if(m_IsValidCopy && m_pParent && m_pParent->m_pChild == this)
if(pEnt->m_pParent)
pEnt->m_pParent->m_DestroyTick = GameTick();
if(m_IsValidCopy && m_pParent && m_pParent->m_pChild == this && pEnt->m_pParent)
pEnt->m_pParent->m_DestroyTick = GameTick();
pEnt->m_pParent = 0;
}
void CGameWorld::RemoveEntities()