@@ -58,9 +58,11 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemId)
5858
5959 bool IsOtherTeam = (pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam (pCurrent->m_Owner ));
6060
61+ int PredictionTick = Client ()->GetPredictionTick ();
62+
6163 float Ct;
6264 if (m_pClient->Predict () && m_pClient->AntiPingGrenade () && LocalPlayerInGame && !IsOtherTeam)
63- Ct = ((float )(Client ()-> PredGameTick (g_Config. m_ClDummy ) - 1 - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy )) / (float )Client ()->GameTickSpeed ();
65+ Ct = ((float )(PredictionTick - 1 - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy )) / (float )Client ()->GameTickSpeed ();
6466 else
6567 Ct = (Client ()->PrevGameTick (g_Config.m_ClDummy ) - pCurrent->m_StartTick ) / (float )Client ()->GameTickSpeed () + s_LastGameTickTime;
6668 if (Ct < 0 )
@@ -304,9 +306,11 @@ void CItems::RenderLaser(const CLaserData *pCurrent, bool IsPredicted)
304306 {
305307 Dir = normalize_pre_length (Pos - From, Len);
306308
309+ int PredictionTick = Client ()->GetPredictionTick ();
310+
307311 float Ticks;
308312 if (IsPredicted)
309- Ticks = (float )(Client ()-> PredGameTick (g_Config. m_ClDummy ) - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy );
313+ Ticks = (float )(PredictionTick - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy );
310314 else
311315 Ticks = (float )(Client ()->GameTick (g_Config.m_ClDummy ) - pCurrent->m_StartTick ) + Client ()->IntraGameTick (g_Config.m_ClDummy );
312316 float Ms = (Ticks / Client ()->GameTickSpeed ()) * 1000 .0f ;
@@ -377,23 +381,23 @@ void CItems::OnRender()
377381 auto &aSwitchers = GameClient ()->Switchers ();
378382 if (UsePredicted)
379383 {
380- for (auto *pProj = (CProjectile *)GameClient ()->m_PredictedWorld .FindFirst (CGameWorld::ENTTYPE_PROJECTILE); pProj; pProj = (CProjectile *)pProj->NextEntity ())
384+ for (auto *pProj = (CProjectile *)GameClient ()->m_PrevPredictedWorld .FindFirst (CGameWorld::ENTTYPE_PROJECTILE); pProj; pProj = (CProjectile *)pProj->NextEntity ())
381385 {
382386 if (!IsSuper && pProj->m_Number > 0 && pProj->m_Number < (int )aSwitchers.size () && !aSwitchers[pProj->m_Number ].m_aStatus [SwitcherTeam] && (pProj->m_Explosive ? BlinkingProjEx : BlinkingProj))
383387 continue ;
384388
385389 CProjectileData Data = pProj->GetData ();
386390 RenderProjectile (&Data, pProj->GetId ());
387391 }
388- for (CEntity *pEnt = GameClient ()->m_PredictedWorld .FindFirst (CGameWorld::ENTTYPE_LASER); pEnt; pEnt = pEnt->NextEntity ())
392+ for (CEntity *pEnt = GameClient ()->m_PrevPredictedWorld .FindFirst (CGameWorld::ENTTYPE_LASER); pEnt; pEnt = pEnt->NextEntity ())
389393 {
390394 auto *const pLaser = dynamic_cast <CLaser *>(pEnt);
391395 if (!pLaser || pLaser->GetOwner () < 0 || !GameClient ()->m_aClients [pLaser->GetOwner ()].m_IsPredictedLocal )
392396 continue ;
393397 CLaserData Data = pLaser->GetData ();
394398 RenderLaser (&Data, true );
395399 }
396- for (auto *pPickup = (CPickup *)GameClient ()->m_PredictedWorld .FindFirst (CGameWorld::ENTTYPE_PICKUP); pPickup; pPickup = (CPickup *)pPickup->NextEntity ())
400+ for (auto *pPickup = (CPickup *)GameClient ()->m_PrevPredictedWorld .FindFirst (CGameWorld::ENTTYPE_PICKUP); pPickup; pPickup = (CPickup *)pPickup->NextEntity ())
397401 {
398402 if (!IsSuper && pPickup->m_Layer == LAYER_SWITCH && pPickup->m_Number > 0 && pPickup->m_Number < (int )aSwitchers.size () && !aSwitchers[pPickup->m_Number ].m_aStatus [SwitcherTeam] && BlinkingPickup)
399403 continue ;
@@ -601,7 +605,10 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
601605 LocalPlayerInGame = m_pClient->m_aClients [m_pClient->m_Snap .m_pLocalInfo ->m_ClientId ].m_Team != TEAM_SPECTATORS;
602606 if (!m_pClient->AntiPingGunfire () || !LocalPlayerInGame)
603607 return ;
604- if (Client ()->PredGameTick (g_Config.m_ClDummy ) == pCurrent->m_StartTick )
608+
609+ int PredictionTick = Client ()->GetPredictionTick ();
610+
611+ if (PredictionTick == pCurrent->m_StartTick )
605612 return ;
606613
607614 // get positions
@@ -625,7 +632,7 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
625632 Speed = pTuning->m_GunSpeed ;
626633 }
627634
628- float Pt = ((float )(Client ()-> PredGameTick (g_Config. m_ClDummy ) - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy )) / (float )Client ()->GameTickSpeed ();
635+ float Pt = ((float )(PredictionTick - pCurrent->m_StartTick ) + Client ()->PredIntraGameTick (g_Config.m_ClDummy )) / (float )Client ()->GameTickSpeed ();
629636 if (Pt < 0 )
630637 return ; // projectile haven't been shot yet
631638
0 commit comments