diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index 4a9fa7c2b..e552640d1 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -54,8 +54,10 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID) if(m_pClient->m_Snap.m_pGameInfoObj && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED)) s_LastGameTickTime = Client()->GameTickTime(g_Config.m_ClDummy); + bool IsOtherTeam = (pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner)); + float Ct; - if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !(Client()->State() == IClient::STATE_DEMOPLAYBACK)) + if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !IsOtherTeam) Ct = ((float)(Client()->PredGameTick(g_Config.m_ClDummy) - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick(g_Config.m_ClDummy)) / (float)SERVER_TICK_SPEED; else Ct = (Client()->PrevGameTick(g_Config.m_ClDummy) - pCurrent->m_StartTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime; @@ -66,7 +68,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID) vec2 PrevPos = CalcPos(pCurrent->m_StartPos, pCurrent->m_StartVel, Curvature, Speed, Ct - 0.001f); float Alpha = 1.f; - if(pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner)) + if(IsOtherTeam) { Alpha = g_Config.m_ClShowOthersAlpha / 100.0f; } @@ -346,15 +348,17 @@ void CItems::OnRender() { if(auto *pProj = (CProjectile *)GameClient()->m_GameWorld.FindMatch(Item.m_ID, Item.m_Type, pData)) { + bool IsOtherTeam = m_pClient->IsOtherTeam(pProj->GetOwner()); if(pProj->m_LastRenderTick <= 0 && (pProj->m_Type != WEAPON_SHOTGUN || (!pProj->m_Freeze && !pProj->m_Explosive)) // skip ddrace shotgun bullets && (pProj->m_Type == WEAPON_SHOTGUN || fabs(length(pProj->m_Direction) - 1.f) < 0.02) // workaround to skip grenades on ball mod - && (pProj->GetOwner() < 0 || !GameClient()->m_aClients[pProj->GetOwner()].m_IsPredictedLocal) // skip locally predicted projectiles + && (pProj->GetOwner() < 0 || !GameClient()->m_aClients[pProj->GetOwner()].m_IsPredictedLocal || IsOtherTeam) // skip locally predicted projectiles && !Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID)) { ReconstructSmokeTrail(&Data, pProj->m_DestroyTick); } pProj->m_LastRenderTick = Client()->GameTick(g_Config.m_ClDummy); - continue; + if(!IsOtherTeam) + continue; } } RenderProjectile(&Data, Item.m_ID); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index f750b4ba7..d15595a17 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1728,12 +1728,20 @@ void CGameClient::OnPredict() bool Dummy = g_Config.m_ClDummy ^ m_IsDummySwapping; m_PredictedWorld.CopyWorld(&m_GameWorld); - // don't predict inactive players + // don't predict inactive players, or entities from other teams for(int i = 0; i < MAX_CLIENTS; i++) if(CCharacter *pChar = m_PredictedWorld.GetCharacterByID(i)) - if(!m_Snap.m_aCharacters[i].m_Active && pChar->m_SnapTicks > 10) + if((!m_Snap.m_aCharacters[i].m_Active && pChar->m_SnapTicks > 10) || IsOtherTeam(i)) pChar->Destroy(); + CProjectile *pProjNext = 0; + for(CProjectile *pProj = (CProjectile *)m_PredictedWorld.FindFirst(CGameWorld::ENTTYPE_PROJECTILE); pProj; pProj = pProjNext) + { + pProjNext = (CProjectile *)pProj->TypeNext(); + if(IsOtherTeam(pProj->GetOwner())) + m_PredictedWorld.RemoveEntity(pProj); + } + CCharacter *pLocalChar = m_PredictedWorld.GetCharacterByID(m_Snap.m_LocalClientID); if(!pLocalChar) return; @@ -2349,6 +2357,7 @@ void CGameClient::UpdatePrediction() m_Snap.m_aCharacters[i].m_HasExtendedData ? &m_Snap.m_aCharacters[i].m_ExtendedData : 0, GameTeam, IsLocal); } + for(int Index = 0; Index < Num; Index++) { IClient::CSnapItem Item; @@ -2382,7 +2391,7 @@ void CGameClient::UpdateRenderedCharacters() Client()->IntraGameTick(g_Config.m_ClDummy)); vec2 Pos = UnpredPos; - if(Predict() && (i == m_Snap.m_LocalClientID || AntiPingPlayers())) + if(Predict() && (i == m_Snap.m_LocalClientID || (AntiPingPlayers() && !IsOtherTeam(i)))) { m_aClients[i].m_Predicted.Write(&m_aClients[i].m_RenderCur); m_aClients[i].m_PrevPredicted.Write(&m_aClients[i].m_RenderPrev);